diff --git a/src/context.c b/src/context.c index c0601896..7d868a0d 100644 --- a/src/context.c +++ b/src/context.c @@ -370,6 +370,21 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig) return GLFW_FALSE; } + 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 + // /and/ the user has requested an OpenGL version greater than 1.0 + + // For API consistency, we emulate the behavior of the + // {GLX|WGL}_ARB_create_context extension and fail here + + _glfwInputError(GLFW_VERSION_UNAVAILABLE, NULL); + return GLFW_FALSE; + } + if (window->context.major >= 3) { // OpenGL 3.0+ uses a different function for extension string retrieval @@ -490,28 +505,6 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig) return GLFW_TRUE; } -GLFWbool _glfwIsValidContext(const _GLFWctxconfig* ctxconfig) -{ - _GLFWwindow* window = _glfwPlatformGetCurrentContext(); - - 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 - // /and/ the user has requested an OpenGL version greater than 1.0 - - // For API consistency, we emulate the behavior of the - // {GLX|WGL}_ARB_create_context extension and fail here - - _glfwInputError(GLFW_VERSION_UNAVAILABLE, NULL); - return GLFW_FALSE; - } - - return GLFW_TRUE; -} - GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions) { const char* start = extensions; diff --git a/src/internal.h b/src/internal.h index ebcd8b31..42835d14 100644 --- a/src/internal.h +++ b/src/internal.h @@ -1009,15 +1009,6 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig); */ GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig); -/*! @brief Checks whether the current context fulfils the specified hard - * constraints. - * @param[in] ctxconfig The desired context attributes. - * @return `GLFW_TRUE` if the context fulfils the hard constraints, or - * `GLFW_FALSE` otherwise. - * @ingroup utility - */ -GLFWbool _glfwIsValidContext(const _GLFWctxconfig* ctxconfig); - /*! @ingroup utility */ void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size); diff --git a/src/window.c b/src/window.c index c10f9acf..bc2f600b 100644 --- a/src/window.c +++ b/src/window.c @@ -210,14 +210,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, return NULL; } - // Verify the context against the requested parameters - if (!_glfwIsValidContext(&ctxconfig)) - { - glfwDestroyWindow((GLFWwindow*) window); - _glfwPlatformMakeContextCurrent(previous); - return NULL; - } - // Restore the previously current context (or NULL) _glfwPlatformMakeContextCurrent(previous); }