X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fandroid%2Ffg_window_android.c;fp=src%2Fandroid%2Ffg_window_android.c;h=6b51091f2cf0fc9773b1baf7f3304e2ec0085170;hb=44856885ba35db9526d24d140b84ce492f4871d2;hp=bbd17fd3a6b125c89ee76187374bcb3f96039edf;hpb=f22dcd6c08a56a76a4a251f39fedfe0ec5f71ed0;p=freeglut diff --git a/src/android/fg_window_android.c b/src/android/fg_window_android.c index bbd17fd..6b51091 100644 --- a/src/android/fg_window_android.c +++ b/src/android/fg_window_android.c @@ -52,6 +52,7 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, return; } + fghChooseConfigEGL(&window->Window.pContext.egl.Config); fghCreateNewContextEGL(window); /* Wait until window is available and OpenGL context is created */ @@ -67,8 +68,16 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, } EGLDisplay display = fgDisplay.pDisplay.egl.Display; - EGLint format = fgDisplay.pDisplay.single_window->Window.pContext.egl.ContextFormat; - ANativeWindow_setBuffersGeometry(window->Window.Handle, 0, 0, format); + + /* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is + * guaranteed to be accepted by ANativeWindow_setBuffersGeometry(). + * As soon as we picked a EGLConfig, we can safely reconfigure the + * ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */ + EGLint vid; + eglGetConfigAttrib(display, window->Window.pContext.egl.Config, + EGL_NATIVE_VISUAL_ID, &vid); + + ANativeWindow_setBuffersGeometry(window->Window.Handle, 0, 0, vid); fghPlatformOpenWindowEGL(window); window->State.Visible = GL_TRUE;