Commit 6d8e78cc authored by Camilla Berglund's avatar Camilla Berglund
Browse files

Further separation of window and context.

The context related parts of _GLFWwndconfig have been moved to
_GLFWctxconfig and given better names.  Window hint and attribute
members have been renamed to match.
parent 0701d4ce
......@@ -971,6 +971,7 @@ static GLboolean createWindow(_GLFWwindow* window,
int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
if (!initializeAppKit())
......@@ -1005,7 +1006,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
if (!createWindow(window, wndconfig))
return GL_FALSE;
if (!_glfwCreateContext(window, wndconfig, fbconfig))
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
return GL_FALSE;
[window->nsgl.context setView:window->ns.view];
......
......@@ -87,21 +87,21 @@ static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev)
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
GLboolean _glfwIsValidContextConfig(const _GLFWwndconfig* wndconfig)
GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig)
{
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->glMajor < 1 || wndconfig->glMinor < 0) ||
(wndconfig->glMajor == 1 && wndconfig->glMinor > 5) ||
(wndconfig->glMajor == 2 && wndconfig->glMinor > 1) ||
(wndconfig->glMajor == 3 && wndconfig->glMinor > 3))
if ((ctxconfig->major < 1 || ctxconfig->minor < 0) ||
(ctxconfig->major == 1 && ctxconfig->minor > 5) ||
(ctxconfig->major == 2 && ctxconfig->minor > 1) ||
(ctxconfig->major == 3 && ctxconfig->minor > 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->glMinor);
ctxconfig->major, ctxconfig->minor);
return GL_FALSE;
}
else
......@@ -118,18 +118,18 @@ GLboolean _glfwIsValidContextConfig(const _GLFWwndconfig* wndconfig)
// For now, let everything else through
}
if (wndconfig->glProfile)
if (ctxconfig->profile)
{
if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE &&
wndconfig->glProfile != GLFW_OPENGL_COMPAT_PROFILE)
if (ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE &&
ctxconfig->profile != GLFW_OPENGL_COMPAT_PROFILE)
{
_glfwInputError(GLFW_INVALID_ENUM,
"Invalid OpenGL profile requested");
return GL_FALSE;
}
if (wndconfig->glMajor < 3 ||
(wndconfig->glMajor == 3 && wndconfig->glMinor < 2))
if (ctxconfig->major < 3 ||
(ctxconfig->major == 3 && ctxconfig->minor < 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->glMajor < 3)
if (ctxconfig->forward && ctxconfig->major < 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->glMajor < 1 || wndconfig->glMinor < 0 ||
(wndconfig->glMajor == 1 && wndconfig->glMinor > 1) ||
(wndconfig->glMajor == 2 && wndconfig->glMinor > 0))
if (ctxconfig->major < 1 || ctxconfig->minor < 0 ||
(ctxconfig->major == 1 && ctxconfig->minor > 1) ||
(ctxconfig->major == 2 && ctxconfig->minor > 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->glMinor);
ctxconfig->major, ctxconfig->minor);
return GL_FALSE;
}
else
......@@ -170,7 +170,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWwndconfig* wndconfig)
// For now, let everything else through
}
if (wndconfig->glProfile)
if (ctxconfig->profile)
{
// OpenGL ES does not support profiles
_glfwInputError(GLFW_INVALID_VALUE,
......@@ -178,7 +178,7 @@ GLboolean _glfwIsValidContextConfig(const _GLFWwndconfig* wndconfig)
return GL_FALSE;
}
if (wndconfig->glForward)
if (ctxconfig->forward)
{
// OpenGL ES does not support forward-compatibility
_glfwInputError(GLFW_INVALID_VALUE,
......@@ -187,10 +187,10 @@ GLboolean _glfwIsValidContextConfig(const _GLFWwndconfig* wndconfig)
}
}
if (wndconfig->glRobustness)
if (ctxconfig->robustness)
{
if (wndconfig->glRobustness != GLFW_NO_RESET_NOTIFICATION &&
wndconfig->glRobustness != GLFW_LOSE_CONTEXT_ON_RESET)
if (ctxconfig->robustness != GLFW_NO_RESET_NOTIFICATION &&
ctxconfig->robustness != 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* wndconfig)
GLboolean _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig)
{
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
if (!parseGLVersion(&window->clientAPI,
&window->glMajor,
&window->glMinor,
&window->glRevision))
if (!parseGLVersion(&window->context.api,
&window->context.major,
&window->context.minor,
&window->context.revision))
{
return GL_FALSE;
}
#if defined(_GLFW_USE_OPENGL)
if (window->glMajor > 2)
if (window->context.major > 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->glMajor >= 3)
if (window->context.major >= 3)
{
GLint flags;
glGetIntegerv(GL_CONTEXT_FLAGS, &flags);
if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)
window->glForward = GL_TRUE;
window->context.forward = GL_TRUE;
if (flags & GL_CONTEXT_FLAG_DEBUG_BIT)
window->glDebug = GL_TRUE;
window->context.debug = GL_TRUE;
else if (glfwExtensionSupported("GL_ARB_debug_output") &&
wndconfig->glDebug)
ctxconfig->debug)
{
// HACK: This is a workaround for older drivers (pre KHR_debug)
// not setting the debug bit in the context flags for
// debug contexts
window->glDebug = GL_TRUE;
window->context.debug = GL_TRUE;
}
}
// Read back OpenGL context profile (OpenGL 3.2 and above)
if (window->glMajor > 3 ||
(window->glMajor == 3 && window->glMinor >= 2))
if (window->context.major > 3 ||
(window->context.major == 3 && window->context.minor >= 2))
{
GLint mask;
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
if (mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)
window->glProfile = GLFW_OPENGL_COMPAT_PROFILE;
window->context.profile = GLFW_OPENGL_COMPAT_PROFILE;
else if (mask & GL_CONTEXT_CORE_PROFILE_BIT)
window->glProfile = GLFW_OPENGL_CORE_PROFILE;
window->context.profile = 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->glProfile = GLFW_OPENGL_COMPAT_PROFILE;
window->context.profile = 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->glRobustness = GLFW_LOSE_CONTEXT_ON_RESET;
window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET;
else if (strategy == GL_NO_RESET_NOTIFICATION_ARB)
window->glRobustness = GLFW_NO_RESET_NOTIFICATION;
window->context.robustness = 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->glRobustness = GLFW_LOSE_CONTEXT_ON_RESET;
window->context.robustness = GLFW_LOSE_CONTEXT_ON_RESET;
else if (strategy == GL_NO_RESET_NOTIFICATION_ARB)
window->glRobustness = GLFW_NO_RESET_NOTIFICATION;
window->context.robustness = GLFW_NO_RESET_NOTIFICATION;
}
}
#endif // _GLFW_USE_OPENGL
......@@ -467,13 +467,13 @@ GLboolean _glfwRefreshContextAttribs(const _GLFWwndconfig* wndconfig)
return GL_TRUE;
}
GLboolean _glfwIsValidContext(const _GLFWwndconfig* wndconfig)
GLboolean _glfwIsValidContext(const _GLFWctxconfig* ctxconfig)
{
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
if (window->glMajor < wndconfig->glMajor ||
(window->glMajor == wndconfig->glMajor &&
window->glMinor < wndconfig->glMinor))
if (window->context.major < ctxconfig->major ||
(window->context.major == ctxconfig->major &&
window->context.minor < ctxconfig->minor))
{
// 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->glMajor < 3)
if (window->context.major < 3)
{
// Check if extension is in the old style OpenGL extensions string
......
......@@ -301,15 +301,15 @@ void _glfwTerminateContextAPI(void)
// Prepare for creation of the OpenGL context
//
int _glfwCreateContext(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
int attribs[40];
GLXFBConfig native;
GLXContext share = NULL;
if (wndconfig->share)
share = wndconfig->share->glx.context;
if (ctxconfig->share)
share = ctxconfig->share->glx.context;
if (!chooseFBConfig(fbconfig, &native))
{
......@@ -328,7 +328,7 @@ int _glfwCreateContext(_GLFWwindow* window,
return GL_FALSE;
}
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
if (ctxconfig->api == GLFW_OPENGL_ES_API)
{
if (!_glfw.glx.ARB_create_context ||
!_glfw.glx.ARB_create_context_profile ||
......@@ -341,7 +341,7 @@ int _glfwCreateContext(_GLFWwindow* window,
}
}
if (wndconfig->glForward)
if (ctxconfig->forward)
{
if (!_glfw.glx.ARB_create_context)
{
......@@ -352,7 +352,7 @@ int _glfwCreateContext(_GLFWwindow* window,
}
}
if (wndconfig->glProfile)
if (ctxconfig->profile)
{
if (!_glfw.glx.ARB_create_context ||
!_glfw.glx.ARB_create_context_profile)
......@@ -370,46 +370,46 @@ int _glfwCreateContext(_GLFWwindow* window,
{
int index = 0, mask = 0, flags = 0, strategy = 0;
if (wndconfig->clientAPI == GLFW_OPENGL_API)
if (ctxconfig->api == GLFW_OPENGL_API)
{
if (wndconfig->glForward)
if (ctxconfig->forward)
flags |= GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
if (wndconfig->glDebug)
if (ctxconfig->debug)
flags |= GLX_CONTEXT_DEBUG_BIT_ARB;
if (wndconfig->glProfile)
if (ctxconfig->profile)
{
if (wndconfig->glProfile == GLFW_OPENGL_CORE_PROFILE)
if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE)
mask |= GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
else if (wndconfig->glProfile == GLFW_OPENGL_COMPAT_PROFILE)
else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
mask |= GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
}
}
else
mask |= GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
if (wndconfig->glRobustness != GLFW_NO_ROBUSTNESS)
if (ctxconfig->robustness != GLFW_NO_ROBUSTNESS)
{
if (_glfw.glx.ARB_create_context_robustness)
{
if (wndconfig->glRobustness == GLFW_NO_RESET_NOTIFICATION)
if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
strategy = GLX_NO_RESET_NOTIFICATION_ARB;
else if (wndconfig->glRobustness == GLFW_LOSE_CONTEXT_ON_RESET)
else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET)
strategy = GLX_LOSE_CONTEXT_ON_RESET_ARB;
flags |= GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB;
}
}
if (wndconfig->glMajor != 1 || wndconfig->glMinor != 0)
if (ctxconfig->major != 1 || ctxconfig->minor != 0)
{
// NOTE: Only request an explicitly versioned context when
// necessary, as explicitly requesting version 1.0 does not
// always return the highest available version
setGLXattrib(GLX_CONTEXT_MAJOR_VERSION_ARB, wndconfig->glMajor);
setGLXattrib(GLX_CONTEXT_MINOR_VERSION_ARB, wndconfig->glMinor);
setGLXattrib(GLX_CONTEXT_MAJOR_VERSION_ARB, ctxconfig->major);
setGLXattrib(GLX_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor);
}
if (mask)
......@@ -437,9 +437,9 @@ int _glfwCreateContext(_GLFWwindow* window,
// context creation with a GLXBadProfileARB error in violation
// of the extension spec
if (_glfw.x11.errorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
wndconfig->clientAPI == GLFW_OPENGL_API &&
wndconfig->glProfile == GLFW_OPENGL_ANY_PROFILE &&
wndconfig->glForward == GL_FALSE)
ctxconfig->api == GLFW_OPENGL_API &&
ctxconfig->profile == GLFW_OPENGL_ANY_PROFILE &&
ctxconfig->forward == GL_FALSE)
{
window->glx.context = createLegacyContext(window, native, share);
}
......
......@@ -124,7 +124,7 @@ typedef struct _GLFWlibraryGLX
int _glfwInitContextAPI(void);
void _glfwTerminateContextAPI(void);
int _glfwCreateContext(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig);
void _glfwDestroyContext(_GLFWwindow* window);
......
......@@ -60,6 +60,7 @@
typedef struct _GLFWhints _GLFWhints;
typedef struct _GLFWwndconfig _GLFWwndconfig;
typedef struct _GLFWctxconfig _GLFWctxconfig;
typedef struct _GLFWfbconfig _GLFWfbconfig;
typedef struct _GLFWwindow _GLFWwindow;
typedef struct _GLFWlibrary _GLFWlibrary;
......@@ -135,11 +136,11 @@ typedef struct _GLFWmonitor _GLFWmonitor;
// Internal types
//========================================================================
/*! @brief Window and context configuration.
/*! @brief Window configuration.
*
* Parameters relating to the creation of the context and window but not
* directly related to the framebuffer. This is used to pass window and
* context creation parameters from shared code to the platform API.
* Parameters relating to the creation of the window but not directly related
* to the framebuffer. This is used to pass context creation parameters from
* shared code to the platform API.
*/
struct _GLFWwndconfig
{
......@@ -149,14 +150,25 @@ struct _GLFWwndconfig
GLboolean resizable;
GLboolean visible;
GLboolean decorated;
int clientAPI;
int glMajor;
int glMinor;
GLboolean glForward;
GLboolean glDebug;
int glProfile;
int glRobustness;
_GLFWmonitor* monitor;
};
/*! @brief Context configuration.
*
* Parameters relating to the creation of the context but not directly related
* to the framebuffer. This is used to pass context creation parameters from
* shared code to the platform API.
*/
struct _GLFWctxconfig
{
int api;
int major;
int minor;
GLboolean forward;
GLboolean debug;
int profile;
int robustness;
_GLFWwindow* share;
};
......@@ -216,11 +228,14 @@ struct _GLFWwindow
char key[GLFW_KEY_LAST + 1];
// OpenGL extensions and context attributes
int clientAPI;
int glMajor, glMinor, glRevision;
GLboolean glForward, glDebug;
int glProfile;
int glRobustness;
struct {
int api;
int major, minor, revision;
GLboolean forward, debug;
int profile;
int robustness;
} context;
#if defined(_GLFW_USE_OPENGL)
PFNGLGETSTRINGIPROC GetStringi;
#endif
......@@ -293,13 +308,13 @@ struct _GLFWlibrary
int samples;
GLboolean sRGB;
int refreshRate;
int clientAPI;
int glMajor;
int glMinor;
GLboolean glForward;
GLboolean glDebug;
int glProfile;
int glRobustness;
int api;
int major;
int minor;
GLboolean forward;
GLboolean debug;
int profile;
int robustness;
} hints;
double cursorPosX, cursorPosY;
......@@ -457,6 +472,7 @@ void _glfwPlatformSetTime(double time);
*/
int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig);
/*! @ingroup platform
......@@ -728,14 +744,14 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
unsigned int count);
/*! @brief Retrieves the attributes of the current context.
* @param[in] wndconfig The desired context attributes.
* @param[in] ctxconfig The desired context attributes.
* @return `GL_TRUE` if successful, or `GL_FALSE` if the context is unusable.
* @ingroup utility
*/
GLboolean _glfwRefreshContextAttribs(const _GLFWwndconfig* wndconfig);
GLboolean _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig);
/*! @brief Checks whether the desired context attributes are valid.
* @param[in] wndconfig The context attributes to check.
* @param[in] ctxconfig The context attributes to check.
* @return `GL_TRUE` if the context attributes are valid, or `GL_FALSE`
* otherwise.
* @ingroup utility
......@@ -744,16 +760,16 @@ GLboolean _glfwRefreshContextAttribs(const _GLFWwndconfig* wndconfig);
* exists and whether all relevant options have supported and non-conflicting
* values.
*/
GLboolean _glfwIsValidContextConfig(const _GLFWwndconfig* wndconfig);
GLboolean _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig);
/*! @brief Checks whether the current context fulfils the specified hard
* constraints.
* @param[in] wndconfig The desired context attributes.
* @param[in] ctxconfig The desired context attributes.
* @return `GL_TRUE` if the context fulfils the hard constraints, or `GL_FALSE`
* otherwise.
* @ingroup utility
*/
GLboolean _glfwIsValidContext(const _GLFWwndconfig* wndconfig);
GLboolean _glfwIsValidContext(const _GLFWctxconfig* ctxconfig);
/*! @ingroup utility
*/
......
......@@ -66,7 +66,7 @@ void _glfwTerminateContextAPI(void)
// Create the OpenGL context
//
int _glfwCreateContext(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
unsigned int attributeCount = 0;
......@@ -78,7 +78,7 @@ int _glfwCreateContext(_GLFWwindow* window,
else if (colorBits < 15)
colorBits = 15;
if (wndconfig->clientAPI == GLFW_OPENGL_ES_API)
if (ctxconfig->api == GLFW_OPENGL_ES_API)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: This API does not support OpenGL ES");
......@@ -86,7 +86,7 @@ int _glfwCreateContext(_GLFWwindow* window,
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (wndconfig->glMajor == 3 && wndconfig->glMinor < 2)
if (ctxconfig->major == 3 && ctxconfig->minor < 2)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: The targeted version of OS X does not "
......@@ -94,9 +94,9 @@ int _glfwCreateContext(_GLFWwindow* window,
return GL_FALSE;
}
if (wndconfig->glMajor > 2)
if (ctxconfig->major > 2)
{
if (!wndconfig->glForward)
if (!ctxconfig->forward)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: The targeted version of OS X only "
......@@ -105,7 +105,7 @@ int _glfwCreateContext(_GLFWwindow* window,
return GL_FALSE;
}
if (wndconfig->glProfile != GLFW_OPENGL_CORE_PROFILE)
if (ctxconfig->profile != GLFW_OPENGL_CORE_PROFILE)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: The targeted version of OS X only "
......@@ -116,7 +116,7 @@ int _glfwCreateContext(_GLFWwindow* window,
}
#else
// Fail if OpenGL 3.0 or above was requested
if (wndconfig->glMajor > 2)
if (ctxconfig->major > 2)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: The targeted version of OS X does not "
......@@ -126,7 +126,7 @@ int _glfwCreateContext(_GLFWwindow* window,
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
// Fail if a robustness strategy was requested
if (wndconfig->glRobustness)
if (ctxconfig->robustness)
{
_glfwInputError(GLFW_VERSION_UNAVAILABLE,
"NSGL: OS X does not support OpenGL robustness "
......@@ -144,7 +144,7 @@ int _glfwCreateContext(_GLFWwindow* window,
ADD_ATTR(NSOpenGLPFAClosestPolicy);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (wndconfig->glMajor > 2)
if (ctxconfig->major > 2)
ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
......@@ -196,8 +196,8 @@ int _glfwCreateContext(_GLFWwindow* window,
NSOpenGLContext* share = NULL;
if (wndconfig->share)
share = wndconfig->share->nsgl.context;
if (ctxconfig->share)
share = ctxconfig->share->nsgl.context;
window->nsgl.context =
[[NSOpenGLContext alloc] initWithFormat:window->nsgl.pixelFormat
......
......@@ -68,7 +68,7 @@ typedef struct _GLFWlibraryNSGL
int _glfwInitContextAPI(void);
void _glfwTerminateContextAPI(void);
int _glfwCreateContext(_GLFWwindow* window,