1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 18:58:52 -05:00

Use EGL_KHR_create_context with GLES as well.

This commit is contained in:
Camilla Berglund 2012-07-22 02:00:00 +02:00
parent bddc95c017
commit ccca5d71fe

View File

@ -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);