diff options
Diffstat (limited to 'progs/egl/demo2.c')
-rw-r--r-- | progs/egl/demo2.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/progs/egl/demo2.c b/progs/egl/demo2.c index 3994656721f..b9e92f62ac2 100644 --- a/progs/egl/demo2.c +++ b/progs/egl/demo2.c @@ -111,11 +111,7 @@ main(int argc, char *argv[]) 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; @@ -149,6 +145,7 @@ main(int argc, char *argv[]) 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"); @@ -169,6 +166,13 @@ main(int argc, char *argv[]) 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"); |