Obey the OPENGL_ES2_PROFILE hint

This commit is contained in:
Jari Vetoniemi 2012-06-30 22:35:26 +03:00
parent 2e7d91ea5a
commit 739be03373

View File

@ -52,7 +52,7 @@ static int getFBConfigAttrib(EGLConfig fbconfig, int attrib)
// Return a list of available and usable framebuffer configs // 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]; EGLConfig fbconfigs[_GLFW_EGL_CONFIG_IN];
_GLFWfbconfig* result; _GLFWfbconfig* result;
@ -106,6 +106,13 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
continue; 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].redBits = getFBConfigAttrib(fbconfigs[i], EGL_RED_SIZE);
result[*found].greenBits = getFBConfigAttrib(fbconfigs[i], EGL_GREEN_SIZE); result[*found].greenBits = getFBConfigAttrib(fbconfigs[i], EGL_GREEN_SIZE);
result[*found].blueBits = getFBConfigAttrib(fbconfigs[i], EGL_BLUE_SIZE); result[*found].blueBits = getFBConfigAttrib(fbconfigs[i], EGL_BLUE_SIZE);
@ -376,7 +383,7 @@ int _glfwCreateContext(_GLFWwindow* window,
_GLFWfbconfig* fbconfigs; _GLFWfbconfig* fbconfigs;
const _GLFWfbconfig* result; const _GLFWfbconfig* result;
fbconfigs = getFBConfigs(window, &fbcount); fbconfigs = getFBConfigs(window, wndconfig, &fbcount);
if (!fbconfigs) if (!fbconfigs)
{ {
_glfwSetError(GLFW_PLATFORM_ERROR, _glfwSetError(GLFW_PLATFORM_ERROR,