From 739be03373aea279e0bb6c7566e1af094fac247e Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Sat, 30 Jun 2012 22:35:26 +0300 Subject: [PATCH] Obey the OPENGL_ES2_PROFILE hint --- src/x11_egl_opengl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/x11_egl_opengl.c b/src/x11_egl_opengl.c index 7df15963..90507f86 100644 --- a/src/x11_egl_opengl.c +++ b/src/x11_egl_opengl.c @@ -52,7 +52,7 @@ static int getFBConfigAttrib(EGLConfig fbconfig, int attrib) // Return a list of available and usable framebuffer configs //======================================================================== -static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found) +static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, unsigned int* found) { EGLConfig fbconfigs[_GLFW_EGL_CONFIG_IN]; _GLFWfbconfig* result; @@ -106,6 +106,13 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found) continue; } + if (wndconfig->glProfile == GLFW_OPENGL_ES2_PROFILE && + !(getFBConfigAttrib(fbconfigs[i], EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES2_BIT)) + { + // User requested only OpenGL ES 2.0 context + continue; + } + result[*found].redBits = getFBConfigAttrib(fbconfigs[i], EGL_RED_SIZE); result[*found].greenBits = getFBConfigAttrib(fbconfigs[i], EGL_GREEN_SIZE); result[*found].blueBits = getFBConfigAttrib(fbconfigs[i], EGL_BLUE_SIZE); @@ -376,7 +383,7 @@ int _glfwCreateContext(_GLFWwindow* window, _GLFWfbconfig* fbconfigs; const _GLFWfbconfig* result; - fbconfigs = getFBConfigs(window, &fbcount); + fbconfigs = getFBConfigs(window, wndconfig, &fbcount); if (!fbconfigs) { _glfwSetError(GLFW_PLATFORM_ERROR,