1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-27 04:28:52 -05:00

Copied context property readback from 2.7.1.

This commit is contained in:
Camilla Berglund 2011-07-27 18:20:15 +02:00
parent e4027f14d0
commit c233e005a8

View File

@ -354,9 +354,36 @@ GLboolean _glfwIsValidContext(_GLFWwindow* window, _GLFWwndconfig* wndconfig)
{ {
parseGLVersion(&window->glMajor, &window->glMinor, &window->glRevision); parseGLVersion(&window->glMajor, &window->glMinor, &window->glRevision);
// As these are hard constraints when non-zero, we can simply copy them // Read back forward-compatibility flag
window->glProfile = wndconfig->glProfile; {
window->glForward = wndconfig->glForward; window->glForward = GL_FALSE;
if (window->glMajor >= 3)
{
GLint flags;
glGetIntegerv(GL_CONTEXT_FLAGS, &flags);
if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
window->glForward = GL_TRUE;
}
}
// Read back OpenGL context profile
{
window->glProfile = 0;
if (window->glMajor > 3 || (window->glMajor == 3 && window->glMinor >= 2))
{
GLint mask;
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
window->glProfile = GLFW_OPENGL_COMPAT_PROFILE;
else if (mask & GL_CONTEXT_CORE_PROFILE_BIT)
window->glProfile = GLFW_OPENGL_CORE_PROFILE;
}
}
window->glRobustness = wndconfig->glRobustness; window->glRobustness = wndconfig->glRobustness;
if (window->glMajor < wndconfig->glMajor || if (window->glMajor < wndconfig->glMajor ||