PrintConfigs(d, configs, numConfigs);
+ eglBindAPI(EGL_OPENGL_API);
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
printf("failed to create context\n");
EGL_HEIGHT, 500,
EGL_NONE
};
- const EGLint screenAttribs[] = {
- EGL_WIDTH, 1024,
- EGL_HEIGHT, 768,
- EGL_NONE
- };
+ EGLint screenAttribs[32];
EGLModeMESA mode;
EGLScreenMESA screen;
EGLint count;
eglGetScreensMESA(d, &screen, 1, &count);
eglGetModesMESA(d, screen, &mode, 1, &count);
+ eglBindAPI(EGL_OPENGL_API);
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
printf("failed to create context\n");
b = eglMakeCurrent(d, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ i = 0;
+ screenAttribs[i++] = EGL_WIDTH;
+ eglGetModeAttribMESA(d, mode, EGL_WIDTH, &screenAttribs[i++]);
+ screenAttribs[i++] = EGL_HEIGHT;
+ eglGetModeAttribMESA(d, mode, EGL_HEIGHT, &screenAttribs[i++]);
+ screenAttribs[i] = EGL_NONE;
+
screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
if (screen_surf == EGL_NO_SURFACE) {
printf("failed to create screen surface\n");
EGLint numConfigs, count;
EGLBoolean b;
const GLubyte *bitmap;
- const EGLint screenAttribs[] = {
- EGL_WIDTH, 1024,
- EGL_HEIGHT, 768,
- EGL_NONE
- };
+ EGLint screenAttribs[32];
+ EGLint i;
EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
assert(d);
eglGetScreensMESA(d, &screen, 1, &count);
eglGetModesMESA(d, screen, &mode, 1, &count);
+ eglBindAPI(EGL_OPENGL_API);
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
printf("failed to create context\n");
return 0;
}
+ i = 0;
+ screenAttribs[i++] = EGL_WIDTH;
+ eglGetModeAttribMESA(d, mode, EGL_WIDTH, &screenAttribs[i++]);
+ screenAttribs[i++] = EGL_HEIGHT;
+ eglGetModeAttribMESA(d, mode, EGL_HEIGHT, &screenAttribs[i++]);
+ screenAttribs[i] = EGL_NONE;
+
screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
if (screen_surf == EGL_NO_SURFACE) {
printf("failed to create screen surface\n");
}
printf("eglgears: Using screen mode/size %d: %d x %d\n", chosenMode, width, height);
+ eglBindAPI(EGL_OPENGL_API);
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
printf("eglgears: failed to create context\n");
}
printf("egltri: Using screen mode/size %d: %d x %d\n", chosenMode, width, height);
+ eglBindAPI(EGL_OPENGL_API);
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
if (ctx == EGL_NO_CONTEXT) {
printf("egltri: failed to create context\n");