@ -87,21 +87,21 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev)
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
GLboolean _glfwIsValidContextConfig ( const _GLFWwndconfig * wnd config )
GLboolean _glfwIsValidContextConfig ( const _GLFWctxconfig * ctx config )
{
if ( wndconfig - > clientAPI ! = GLFW_OPENGL_API & &
wndconfig - > clientAPI ! = GLFW_OPENGL_ES_API )
if ( ctxconfig - > api ! = GLFW_OPENGL_API & &
ctxconfig - > api ! = GLFW_OPENGL_ES_API )
{
_glfwInputError ( GLFW_INVALID_ENUM , " Invalid client API requested " ) ;
return GL_FALSE ;
}
if ( wndconfig - > clientAPI = = GLFW_OPENGL_API )
if ( ctxconfig - > api = = GLFW_OPENGL_API )
{
if ( ( wndconfig - > glM ajor < 1 | | wndconfig - > glM inor < 0 ) | |
( wndconfig - > glM ajor = = 1 & & wndconfig - > glM inor > 5 ) | |
( wndconfig - > glM ajor = = 2 & & wndconfig - > glM inor > 1 ) | |
( wndconfig - > glM ajor = = 3 & & wndconfig - > glM inor > 3 ) )
if ( ( ctxconfig - > m ajor < 1 | | ctxconfig - > m inor < 0 ) | |
( ctxconfig - > m ajor = = 1 & & ctxconfig - > m inor > 5 ) | |
( ctxconfig - > m ajor = = 2 & & ctxconfig - > m inor > 1 ) | |
( ctxconfig - > m ajor = = 3 & & ctxconfig - > m inor > 3 ) )
{
// OpenGL 1.0 is the smallest valid version
// OpenGL 1.x series ended with version 1.5
@ -110,7 +110,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWwndconfig* wndconfig)
_glfwInputError ( GLFW_INVALID_VALUE ,
" Invalid OpenGL version %i.%i requested " ,
wndconfig - > glMajor , wndconfig - > glM inor) ;
ctxconfig - > major , ctxconfig - > m inor) ;
return GL_FALSE ;
}
else
@ -118,18 +118,18 @@ GLboolean _glfwIsValidContextConfig(const _GLFWwndconfig* wndconfig)
// For now, let everything else through
}
if ( wndconfig - > glP rofile)
if ( ctxconfig - > p rofile)
{
if ( wndconfig - > glP rofile ! = GLFW_OPENGL_CORE_PROFILE & &
wndconfig - > glP rofile ! = GLFW_OPENGL_COMPAT_PROFILE )
if ( ctxconfig - > p rofile ! = GLFW_OPENGL_CORE_PROFILE & &
ctxconfig - > p rofile ! = GLFW_OPENGL_COMPAT_PROFILE )
{
_glfwInputError ( GLFW_INVALID_ENUM ,
" Invalid OpenGL profile requested " ) ;
return GL_FALSE ;
}
if ( wndconfig - > glM ajor < 3 | |
( wndconfig - > glM ajor = = 3 & & wndconfig - > glM inor < 2 ) )
if ( ctxconfig - > m ajor < 3 | |
( ctxconfig - > m ajor = = 3 & & ctxconfig - > m inor < 2 ) )
{
// Desktop OpenGL context profiles are only defined for version 3.2
// and above
@ -141,7 +141,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWwndconfig* wndconfig)
}
}
if ( wndconfig - > glForward & & wndconfig - > glM ajor < 3 )
if ( ctxconfig - > forward & & ctxconfig - > m ajor < 3 )
{
// Forward-compatible contexts are only defined for OpenGL version 3.0 and above
_glfwInputError ( GLFW_INVALID_VALUE ,
@ -150,11 +150,11 @@ GLboolean _glfwIsValidContextConfig(const _GLFWwndconfig* wndconfig)
return GL_FALSE ;
}
}
else if ( wndconfig - > clientAPI = = GLFW_OPENGL_ES_API )
else if ( ctxconfig - > api = = GLFW_OPENGL_ES_API )
{
if ( wndconfig - > glM ajor < 1 | | wndconfig - > glM inor < 0 | |
( wndconfig - > glM ajor = = 1 & & wndconfig - > glM inor > 1 ) | |
( wndconfig - > glM ajor = = 2 & & wndconfig - > glM inor > 0 ) )
if ( ctxconfig - > m ajor < 1 | | ctxconfig - > m inor < 0 | |
( ctxconfig - > m ajor = = 1 & & ctxconfig - > m inor > 1 ) | |
( ctxconfig - > m ajor = = 2 & & ctxconfig - > m inor > 0 ) )
{
// OpenGL ES 1.0 is the smallest valid version
// OpenGL ES 1.x series ended with version 1.1
@ -162,7 +162,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWwndconfig* wndconfig)
_glfwInputError ( GLFW_INVALID_VALUE ,
" Invalid OpenGL ES version %i.%i requested " ,
wndconfig - > glMajor , wndconfig - > glM inor) ;
ctxconfig - > major , ctxconfig - > m inor) ;
return GL_FALSE ;
}
else
@ -170,7 +170,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWwndconfig* wndconfig)
// For now, let everything else through
}
if ( wndconfig - > glP rofile)
if ( ctxconfig - > p rofile)
{
// OpenGL ES does not support profiles
_glfwInputError ( GLFW_INVALID_VALUE ,
@ -178,7 +178,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWwndconfig* wndconfig)
return GL_FALSE ;
}
if ( wndconfig - > glF orward)
if ( ctxconfig - > f orward)
{
// OpenGL ES does not support forward-compatibility
_glfwInputError ( GLFW_INVALID_VALUE ,
@ -187,10 +187,10 @@ GLboolean _glfwIsValidContextConfig(const _GLFWwndconfig* wndconfig)
}
}
if ( wndconfig - > glR obustness)
if ( ctxconfig - > r obustness)
{
if ( wndconfig - > glR obustness ! = GLFW_NO_RESET_NOTIFICATION & &
wndconfig - > glR obustness ! = GLFW_LOSE_CONTEXT_ON_RESET )
if ( ctxconfig - > r obustness ! = GLFW_NO_RESET_NOTIFICATION & &
ctxconfig - > r obustness ! = GLFW_LOSE_CONTEXT_ON_RESET )
{
_glfwInputError ( GLFW_INVALID_VALUE ,
" Invalid context robustness mode requested " ) ;
@ -358,20 +358,20 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
return closest ;
}
GLboolean _glfwRefreshContextAttribs ( const _GLFWwndconfig * wnd config )
GLboolean _glfwRefreshContextAttribs ( const _GLFWctxconfig * ctx config )
{
_GLFWwindow * window = _glfwPlatformGetCurrentContext ( ) ;
if ( ! parseGLVersion ( & window - > clientAPI ,
& window - > glM ajor,
& window - > glM inor,
& window - > glR evision) )
if ( ! parseGLVersion ( & window - > context . api ,
& window - > context . m ajor,
& window - > context . m inor,
& window - > context . r evision) )
{
return GL_FALSE ;
}
# if defined(_GLFW_USE_OPENGL)
if ( window - > glM ajor > 2 )
if ( window - > context . m ajor > 2 )
{
// OpenGL 3.0+ uses a different function for extension string retrieval
// We cache it here instead of in glfwExtensionSupported mostly to alert
@ -386,47 +386,47 @@ GLboolean _glfwRefreshContextAttribs(const _GLFWwndconfig* wndconfig)
}
}
if ( window - > clientAPI = = GLFW_OPENGL_API )
if ( window - > context . api = = GLFW_OPENGL_API )
{
// Read back context flags (OpenGL 3.0 and above)
if ( window - > glM ajor > = 3 )
if ( window - > context . m ajor > = 3 )
{
GLint flags ;
glGetIntegerv ( GL_CONTEXT_FLAGS , & flags ) ;
if ( flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT )
window - > glF orward = GL_TRUE ;
window - > context . f orward = GL_TRUE ;
if ( flags & GL_CONTEXT_FLAG_DEBUG_BIT )
window - > glD ebug = GL_TRUE ;
window - > context . d ebug = GL_TRUE ;
else if ( glfwExtensionSupported ( " GL_ARB_debug_output " ) & &
wndconfig - > glD ebug)
ctxconfig - > d ebug)
{
// HACK: This is a workaround for older drivers (pre KHR_debug)
// not setting the debug bit in the context flags for
// debug contexts
window - > glD ebug = GL_TRUE ;
window - > context . d ebug = GL_TRUE ;
}
}
// Read back OpenGL context profile (OpenGL 3.2 and above)
if ( window - > glM ajor > 3 | |
( window - > glM ajor = = 3 & & window - > glM inor > = 2 ) )
if ( window - > context . m ajor > 3 | |
( window - > context . m ajor = = 3 & & window - > context . m inor > = 2 ) )
{
GLint mask ;
glGetIntegerv ( GL_CONTEXT_PROFILE_MASK , & mask ) ;
if ( mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT )
window - > glP rofile = GLFW_OPENGL_COMPAT_PROFILE ;
window - > context . p rofile = GLFW_OPENGL_COMPAT_PROFILE ;
else if ( mask & GL_CONTEXT_CORE_PROFILE_BIT )
window - > glP rofile = GLFW_OPENGL_CORE_PROFILE ;
window - > context . p rofile = GLFW_OPENGL_CORE_PROFILE ;
else if ( glfwExtensionSupported ( " GL_ARB_compatibility " ) )
{
// HACK: This is a workaround for the compatibility profile bit
// not being set in the context flags if an OpenGL 3.2+
// context was created without having requested a specific
// version
window - > glP rofile = GLFW_OPENGL_COMPAT_PROFILE ;
window - > context . p rofile = GLFW_OPENGL_COMPAT_PROFILE ;
}
}
@ -440,9 +440,9 @@ GLboolean _glfwRefreshContextAttribs(const _GLFWwndconfig* wndconfig)
glGetIntegerv ( GL_RESET_NOTIFICATION_STRATEGY_ARB , & strategy ) ;
if ( strategy = = GL_LOSE_CONTEXT_ON_RESET_ARB )
window - > glR obustness = GLFW_LOSE_CONTEXT_ON_RESET ;
window - > context . r obustness = GLFW_LOSE_CONTEXT_ON_RESET ;
else if ( strategy = = GL_NO_RESET_NOTIFICATION_ARB )
window - > glR obustness = GLFW_NO_RESET_NOTIFICATION ;
window - > context . r obustness = GLFW_NO_RESET_NOTIFICATION ;
}
}
else
@ -457,9 +457,9 @@ GLboolean _glfwRefreshContextAttribs(const _GLFWwndconfig* wndconfig)
glGetIntegerv ( GL_RESET_NOTIFICATION_STRATEGY_ARB , & strategy ) ;
if ( strategy = = GL_LOSE_CONTEXT_ON_RESET_ARB )
window - > glR obustness = GLFW_LOSE_CONTEXT_ON_RESET ;
window - > context . r obustness = GLFW_LOSE_CONTEXT_ON_RESET ;
else if ( strategy = = GL_NO_RESET_NOTIFICATION_ARB )
window - > glR obustness = GLFW_NO_RESET_NOTIFICATION ;
window - > context . r obustness = GLFW_NO_RESET_NOTIFICATION ;
}
}
# endif // _GLFW_USE_OPENGL
@ -467,13 +467,13 @@ GLboolean _glfwRefreshContextAttribs(const _GLFWwndconfig* wndconfig)
return GL_TRUE ;
}
GLboolean _glfwIsValidContext ( const _GLFWwndconfig * wnd config )
GLboolean _glfwIsValidContext ( const _GLFWctxconfig * ctx config )
{
_GLFWwindow * window = _glfwPlatformGetCurrentContext ( ) ;
if ( window - > glMajor < wndconfig - > glM ajor | |
( window - > glMajor = = wndconfig - > glM ajor & &
window - > glMinor < wndconfig - > glM inor) )
if ( window - > context . major < ctxconfig - > m ajor | |
( window - > context . major = = ctxconfig - > m ajor & &
window - > context . minor < ctxconfig - > m inor) )
{
// The desired OpenGL version is greater than the actual version
// This only happens if the machine lacks {GLX|WGL}_ARB_create_context
@ -581,7 +581,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
return GL_FALSE ;
}
if ( window - > glM ajor < 3 )
if ( window - > context . m ajor < 3 )
{
// Check if extension is in the old style OpenGL extensions string