* Print table of all available configurations.
*/
static void
-PrintConfigs(EGLDisplay d)
+PrintConfigs(EGLDisplay d, EGLConfig *configs, EGLint numConfigs)
{
- EGLConfig *configs;
- EGLint numConfigs, i;
-
- eglGetConfigs(d, NULL, 0, &numConfigs);
- configs = malloc(sizeof(*configs) *numConfigs);
- eglGetConfigs(d, configs, numConfigs, &numConfigs);
+ EGLint i;
printf("Configurations:\n");
printf(" bf lv d st colorbuffer dp st supported \n");
red, green, blue, alpha,
depth, stencil, surfString);
}
- free(configs);
}
int maj, min;
EGLContext ctx;
EGLSurface pbuffer;
- EGLConfig configs[10];
+ EGLConfig *configs;
+ EGLint numConfigs;
EGLBoolean b;
const EGLint pbufAttribs[] = {
EGL_WIDTH, 500,
printf("EGL version = %d.%d\n", maj, min);
printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
- PrintConfigs(d);
+ eglGetConfigs(d, NULL, 0, &numConfigs);
+ configs = malloc(sizeof(*configs) *numConfigs);
+ eglGetConfigs(d, configs, numConfigs, &numConfigs);
+
+ PrintConfigs(d, configs, numConfigs);
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
return 0;
}
+ free(configs);
+
b = eglMakeCurrent(d, pbuffer, pbuffer, ctx);
if (!b) {
printf("make current failed\n");