From ccca5d71fe8e17f8deb8f443878c4fce1013f8fe Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 22 Jul 2012 02:00:00 +0200 Subject: [PATCH] Use EGL_KHR_create_context with GLES as well. --- src/x11_egl_opengl.c | 100 +++++++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/src/x11_egl_opengl.c b/src/x11_egl_opengl.c index 84f50bd4..2484841b 100644 --- a/src/x11_egl_opengl.c +++ b/src/x11_egl_opengl.c @@ -252,62 +252,62 @@ static int createContext(_GLFWwindow* window, return GL_FALSE; } + if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) + eglBindAPI(EGL_OPENGL_ES_API); + else + eglBindAPI(EGL_OPENGL_API); + index = 0; - if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) + if (_glfwLibrary.EGL.KHR_create_context) { - eglBindAPI(EGL_OPENGL_ES_API); - setEGLattrib(attribs, index, EGL_CONTEXT_CLIENT_VERSION, wndconfig->glMajor); + setEGLattrib(attribs, index, EGL_CONTEXT_MAJOR_VERSION_KHR, wndconfig->glMajor); + setEGLattrib(attribs, index, EGL_CONTEXT_MINOR_VERSION_KHR, wndconfig->glMinor); + + if (wndconfig->glForward || wndconfig->glDebug || wndconfig->glRobustness) + { + int flags = 0; + + if (wndconfig->glForward) + flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR; + + if (wndconfig->glDebug) + flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR; + + if (wndconfig->glRobustness) + flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR; + + setEGLattrib(attribs, index, EGL_CONTEXT_FLAGS_KHR, flags); + } + + if (wndconfig->glProfile) + { + int flags = 0; + + if (wndconfig->glProfile == GLFW_OPENGL_CORE_PROFILE) + flags = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR; + else if (wndconfig->glProfile == GLFW_OPENGL_COMPAT_PROFILE) + flags = EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR; + + setEGLattrib(attribs, index, EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, flags); + } + + if (wndconfig->glRobustness) + { + int strategy; + + if (wndconfig->glRobustness == GLFW_OPENGL_NO_RESET_NOTIFICATION) + strategy = EGL_NO_RESET_NOTIFICATION_KHR; + else if (wndconfig->glRobustness == GLFW_OPENGL_LOSE_CONTEXT_ON_RESET) + strategy = EGL_LOSE_CONTEXT_ON_RESET_KHR; + + setEGLattrib(attribs, index, EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, strategy); + } } else { - eglBindAPI(EGL_OPENGL_API); - - if (_glfwLibrary.EGL.KHR_create_context) - { - setEGLattrib(attribs, index, EGL_CONTEXT_MAJOR_VERSION_KHR, wndconfig->glMajor); - setEGLattrib(attribs, index, EGL_CONTEXT_MINOR_VERSION_KHR, wndconfig->glMinor); - - if (wndconfig->glForward || wndconfig->glDebug || wndconfig->glRobustness) - { - int flags = 0; - - if (wndconfig->glForward) - flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR; - - if (wndconfig->glDebug) - flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR; - - if (wndconfig->glRobustness) - flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR; - - setEGLattrib(attribs, index, EGL_CONTEXT_FLAGS_KHR, flags); - } - - if (wndconfig->glProfile) - { - int flags = 0; - - if (wndconfig->glProfile == GLFW_OPENGL_CORE_PROFILE) - flags = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR; - else if (wndconfig->glProfile == GLFW_OPENGL_COMPAT_PROFILE) - flags = EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR; - - setEGLattrib(attribs, index, EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, flags); - } - - if (wndconfig->glRobustness) - { - int strategy; - - if (wndconfig->glRobustness == GLFW_OPENGL_NO_RESET_NOTIFICATION) - strategy = EGL_NO_RESET_NOTIFICATION_KHR; - else if (wndconfig->glRobustness == GLFW_OPENGL_LOSE_CONTEXT_ON_RESET) - strategy = EGL_LOSE_CONTEXT_ON_RESET_KHR; - - setEGLattrib(attribs, index, EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, strategy); - } - } + if (wndconfig->clientAPI == GLFW_OPENGL_ES_API) + setEGLattrib(attribs, index, EGL_CONTEXT_CLIENT_VERSION, wndconfig->glMajor); } setEGLattrib(attribs, index, EGL_NONE, EGL_NONE);