diff --git a/examples/heightmap.c b/examples/heightmap.c index 60ac99d2..de15feb5 100644 --- a/examples/heightmap.c +++ b/examples/heightmap.c @@ -582,8 +582,8 @@ int main(int argc, char** argv) } glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); - glfwWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); - glfwWindowHint(GLFW_OPENGL_VERSION_MINOR, 2); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_FALSE); diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h index a5cbc452..539c2de5 100644 --- a/include/GL/glfw3.h +++ b/include/GL/glfw3.h @@ -48,6 +48,8 @@ extern "C" { /*! @defgroup clipboard Clipboard support */ +/*! @defgroup context Context handling + */ /*! @defgroup error Error handling */ /*! @defgroup gamma Gamma ramp support @@ -58,15 +60,14 @@ extern "C" { */ /*! @defgroup monitor Monitor handling */ -/*! @defgroup opengl OpenGL support - */ /*! @defgroup time Time input */ /*! @defgroup window Window handling * - * The primary purpose of GLFW is to provide a simple interface to OpenGL - * context creation and window management. GLFW supports multiple windows, - * which can be either a normal desktop window or a fullscreen window. + * The primary purpose of GLFW is to provide a simple interface to window + * management and OpenGL and OpenGL ES context creation. GLFW supports + * multiple windows, which can be either a normal desktop window or + * a fullscreen window. */ @@ -173,7 +174,7 @@ extern "C" { /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ -/* Include the chosen OpenGL header and, optionally, the GLU header. +/* Include the chosen client API headers. */ #if defined(__APPLE_CC__) #if defined(GLFW_INCLUDE_GLCOREARB) @@ -467,9 +468,9 @@ extern "C" { * otherwise. */ #define GLFW_CLOSE_REQUESTED 0x00020003 -/*! @brief The OpenGL API version revision. +/*! @brief The client API version revision. */ -#define GLFW_OPENGL_REVISION 0x00020004 +#define GLFW_CONTEXT_REVISION 0x00020004 /*! @brief The bit depth of the red component of the color buffer. */ @@ -522,12 +523,12 @@ extern "C" { /*! @brief The @link clients client API @endlink to create a context for. */ #define GLFW_CLIENT_API 0x00022000 -#define GLFW_OPENGL_VERSION_MAJOR 0x00022001 -#define GLFW_OPENGL_VERSION_MINOR 0x00022002 -#define GLFW_OPENGL_FORWARD_COMPAT 0x00022003 -#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022004 -#define GLFW_OPENGL_PROFILE 0x00022005 -#define GLFW_OPENGL_ROBUSTNESS 0x00022006 +#define GLFW_CONTEXT_VERSION_MAJOR 0x00022001 +#define GLFW_CONTEXT_VERSION_MINOR 0x00022002 +#define GLFW_CONTEXT_ROBUSTNESS 0x00022003 +#define GLFW_OPENGL_FORWARD_COMPAT 0x00022004 +#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022005 +#define GLFW_OPENGL_PROFILE 0x00022006 /*! @brief @c GL_TRUE if the window is resizable, or @c GL_FALSE otherwise. */ #define GLFW_RESIZABLE 0x00022007 @@ -548,45 +549,45 @@ extern "C" { /*! @name Client APIs * @{ */ /*! @brief The OpenGL API. - * @ingroup opengl + * @ingroup context */ #define GLFW_OPENGL_API 0x00000001 /*! @brief The OpenGL ES API. - * @ingroup opengl + * @ingroup context */ #define GLFW_OPENGL_ES_API 0x00000002 /*! @} */ -/*! @name OpenGL robustness strategies +/*! @name Context robustness strategies * @{ */ /*! @brief No robustness strategy is used. * * This is the default. - * @ingroup opengl + * @ingroup context */ -#define GLFW_OPENGL_NO_ROBUSTNESS 0x00000000 +#define GLFW_NO_ROBUSTNESS 0x00000000 /*! @brief - * @ingroup opengl + * @ingroup context */ -#define GLFW_OPENGL_NO_RESET_NOTIFICATION 0x00000001 +#define GLFW_NO_RESET_NOTIFICATION 0x00000001 /*! @brief - * @ingroup opengl + * @ingroup context */ -#define GLFW_OPENGL_LOSE_CONTEXT_ON_RESET 0x00000002 +#define GLFW_LOSE_CONTEXT_ON_RESET 0x00000002 /*! @} */ /*! @name OpenGL profiles * @{ */ /*! @brief No OpenGL profile. - * @ingroup opengl + * @ingroup context */ #define GLFW_OPENGL_NO_PROFILE 0x00000000 /*! @brief The OpenGL core profile. - * @ingroup opengl + * @ingroup context */ #define GLFW_OPENGL_CORE_PROFILE 0x00000001 /*! @brief The OpenGL compatibility profile. - * @ingroup opengl + * @ingroup context */ #define GLFW_OPENGL_COMPAT_PROFILE 0x00000002 /*! @} */ @@ -667,7 +668,7 @@ extern "C" { * system. */ #define GLFW_API_UNAVAILABLE 0x00070006 -/*! @brief The requested OpenGL or GLES version is not available. +/*! @brief The requested client API version is not available. */ #define GLFW_VERSION_UNAVAILABLE 0x00070007 /*! @brief A platform-specific error occurred that does not match any of the @@ -722,8 +723,8 @@ extern "C" { * Typedefs *************************************************************************/ -/*! @brief OpenGL function pointer type. - * @ingroup opengl +/*! @brief Client API function pointer type. + * @ingroup context */ typedef void (*GLFWglproc)(void); @@ -1078,8 +1079,8 @@ GLFWAPI void glfwSetGammaRamp(const GLFWgammaramp* ramp); * * The @ref GLFW_CLIENT_API hint is set to @ref GLFW_OPENGL_API. * - * The @ref GLFW_OPENGL_VERSION_MAJOR and @ref GLFW_OPENGL_VERSION_MINOR hints - * are set to 1 and 0, respectively. + * The @ref GLFW_CONTEXT_VERSION_MAJOR and @ref GLFW_CONTEXT_VERSION_MINOR + * hints are set to 1 and 0, respectively. * * All other hints are set to 0. * @@ -1123,15 +1124,18 @@ GLFWAPI void glfwDefaultWindowHints(void); * context for. Possible values are @ref GLFW_OPENGL_API and @ref * GLFW_OPENGL_ES_API. * - * The @ref GLFW_OPENGL_VERSION_MAJOR and @ref GLFW_OPENGL_VERSION_MINOR hints - * specify the OpenGL version that the created context must be compatible with. + * The @ref GLFW_CONTEXT_VERSION_MAJOR and @ref GLFW_CONTEXT_VERSION_MINOR + * hints specify the client API version that the created context must be + * compatible with. * - * These hints are @em not hard constraints, as they don't have to match - * exactly, but @ref glfwCreateWindow will still fail if the resulting OpenGL - * version is less than the one requested with hints. It is therefore - * perfectly safe to use the default of version 1.0 for legacy code and you - * will still get backwards-compatible contexts of version 3.0 and above when - * available. + * For OpenGL, these hints are @em not hard constraints, as they don't have to + * match exactly, but @ref glfwCreateWindow will still fail if the resulting + * OpenGL version is less than the one requested. It is therefore perfectly + * safe to use the default of version 1.0 for legacy code and you will still + * get backwards-compatible contexts of version 3.0 and above when available. + * + * For OpenGL ES, these hints are hard constraints, as there is no backward + * compatibility between OpenGL ES versions. * * The @ref GLFW_OPENGL_FORWARD_COMPAT hint specifies whether the OpenGL * context should be forward-compatible, i.e. one where all functionality @@ -1145,8 +1149,8 @@ GLFWAPI void glfwDefaultWindowHints(void); * the context for. Possible values are @ref GLFW_OPENGL_NO_PROFILE, @ref * GLFW_OPENGL_CORE_PROFILE and @ref GLFW_OPENGL_COMPAT_PROFILE. * - * The @ref GLFW_OPENGL_ROBUSTNESS hint specifies the robustness strategy to be - * used by the OpenGL context. + * The @ref GLFW_CONTEXT_ROBUSTNESS hint specifies the robustness strategy to + * be used by the context. * * The @ref GLFW_RESIZABLE hint specifies whether the window will be resizable * by the user. The window will still be resizable using the @ref @@ -1359,9 +1363,9 @@ GLFWAPI GLFWmonitor glfwGetWindowMonitor(GLFWwindow window); * The @ref GLFW_CLIENT_API property indicates the client API provided by the * window's context. * - * The @ref GLFW_OPENGL_VERSION_MAJOR, @ref GLFW_OPENGL_VERSION_MINOR and @ref - * GLFW_OPENGL_REVISION properties indicate the API version of the window's - * context. + * The @ref GLFW_CONTEXT_VERSION_MAJOR, @ref GLFW_CONTEXT_VERSION_MINOR and + * @ref GLFW_CONTEXT_REVISION properties indicate the client API version of the + * window's context. * * The @ref GLFW_OPENGL_FORWARD_COMPAT property indicates whether an OpenGL * context is forward-compatible. @@ -1373,9 +1377,8 @@ GLFWAPI GLFWmonitor glfwGetWindowMonitor(GLFWwindow window); * OpenGL context, or @ref GLFW_OPENGL_NO_PROFILE if the context is for another * client API than OpenGL. * - * The @ref GLFW_OPENGL_ROBUSTNESS property indicates the robustness strategy - * used by the OpenGL context, or @ref GLFW_OPENGL_NO_ROBUSTNESS if robustness - * is not used. + * The @ref GLFW_CONTEXT_ROBUSTNESS property indicates the robustness strategy + * used by the context, or @ref GLFW_NO_ROBUSTNESS if robustness is not used. */ GLFWAPI int glfwGetWindowParam(GLFWwindow window, int param); @@ -1698,7 +1701,7 @@ GLFWAPI void glfwSetTime(double time); /*! @brief Makes the context of the specified window current for this thread. * @param[in] window The window whose context to make current, or @c NULL to * detach the current context. - * @ingroup opengl + * @ingroup context * * @remarks This function may be called from secondary threads. * @@ -1711,7 +1714,7 @@ GLFWAPI void glfwMakeContextCurrent(GLFWwindow window); /*! @brief Returns the window whose context is current on this thread. * @return The window whose context is current, or @c NULL if no window's * context is current. - * @ingroup opengl + * @ingroup context * * @remarks This function may be called from secondary threads. * @@ -1721,7 +1724,7 @@ GLFWAPI GLFWwindow glfwGetCurrentContext(void); /*! @brief Swaps the front and back buffers of the specified window. * @param[in] The window whose buffers to swap. - * @ingroup opengl + * @ingroup context * * @remarks This function may be called from secondary threads. * @@ -1732,7 +1735,7 @@ GLFWAPI void glfwSwapBuffers(GLFWwindow window); /*! @brief Sets the swap interval for the current context. * @param[in] interval The minimum number of video frame periods to wait for * until the buffers are swapped by @ref glfwSwapBuffers. - * @ingroup opengl + * @ingroup context * * @remarks This function may be called from secondary threads. * @@ -1743,7 +1746,7 @@ GLFWAPI void glfwSwapInterval(int interval); /*! @brief Checks whether the specified extension is available. * @param[in] extension The ASCII encoded name of the extension. * @return @c GL_TRUE if the extension is available, or @c FALSE otherwise. - * @ingroup opengl + * @ingroup context * * @remarks This function may be called from secondary threads. * @@ -1757,7 +1760,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension); * @param[in] procname The ASCII encoded name of the function. * @return The address of the function, or @c NULL if the function is * unavailable. - * @ingroup opengl + * @ingroup context * * @remarks This function may be called from secondary threads. */ diff --git a/src/context.c b/src/context.c index eec07205..2c3a7f23 100644 --- a/src/context.c +++ b/src/context.c @@ -377,8 +377,8 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) if (wndconfig->glRobustness) { - if (wndconfig->glRobustness != GLFW_OPENGL_NO_RESET_NOTIFICATION && - wndconfig->glRobustness != GLFW_OPENGL_LOSE_CONTEXT_ON_RESET) + if (wndconfig->glRobustness != GLFW_NO_RESET_NOTIFICATION && + wndconfig->glRobustness != GLFW_LOSE_CONTEXT_ON_RESET) { _glfwSetError(GLFW_INVALID_VALUE, "glfwCreateWindow: Invalid OpenGL robustness mode " diff --git a/src/egl_context.c b/src/egl_context.c index 3c164520..235dfc2f 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -318,9 +318,9 @@ static int createContext(_GLFWwindow* window, { int strategy; - if (wndconfig->glRobustness == GLFW_OPENGL_NO_RESET_NOTIFICATION) + if (wndconfig->glRobustness == GLFW_NO_RESET_NOTIFICATION) strategy = EGL_NO_RESET_NOTIFICATION_KHR; - else if (wndconfig->glRobustness == GLFW_OPENGL_LOSE_CONTEXT_ON_RESET) + else if (wndconfig->glRobustness == GLFW_LOSE_CONTEXT_ON_RESET) strategy = EGL_LOSE_CONTEXT_ON_RESET_KHR; setEGLattrib(attribs, index, EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR, strategy); diff --git a/src/glx_context.c b/src/glx_context.c index a8b4a189..e826897b 100644 --- a/src/glx_context.c +++ b/src/glx_context.c @@ -365,9 +365,9 @@ static int createContext(_GLFWwindow* window, return GL_FALSE; } - if (wndconfig->glRobustness == GLFW_OPENGL_NO_RESET_NOTIFICATION) + if (wndconfig->glRobustness == GLFW_NO_RESET_NOTIFICATION) strategy = GLX_NO_RESET_NOTIFICATION_ARB; - else if (wndconfig->glRobustness == GLFW_OPENGL_LOSE_CONTEXT_ON_RESET) + else if (wndconfig->glRobustness == GLFW_LOSE_CONTEXT_ON_RESET) strategy = GLX_LOSE_CONTEXT_ON_RESET_ARB; setGLXattrib(attribs, diff --git a/src/wgl_context.c b/src/wgl_context.c index 80d7470e..829647f1 100644 --- a/src/wgl_context.c +++ b/src/wgl_context.c @@ -434,9 +434,9 @@ static GLboolean createContext(_GLFWwindow* window, return GL_FALSE; } - if (wndconfig->glRobustness == GLFW_OPENGL_NO_RESET_NOTIFICATION) + if (wndconfig->glRobustness == GLFW_NO_RESET_NOTIFICATION) strategy = WGL_NO_RESET_NOTIFICATION_ARB; - else if (wndconfig->glRobustness == GLFW_OPENGL_LOSE_CONTEXT_ON_RESET) + else if (wndconfig->glRobustness == GLFW_LOSE_CONTEXT_ON_RESET) strategy = WGL_LOSE_CONTEXT_ON_RESET_ARB; attribs[i++] = WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB; diff --git a/src/window.c b/src/window.c index 9e430835..38748377 100644 --- a/src/window.c +++ b/src/window.c @@ -447,12 +447,15 @@ GLFWAPI void glfwWindowHint(int target, int hint) case GLFW_CLIENT_API: _glfwLibrary.hints.clientAPI = hint; break; - case GLFW_OPENGL_VERSION_MAJOR: + case GLFW_CONTEXT_VERSION_MAJOR: _glfwLibrary.hints.glMajor = hint; break; - case GLFW_OPENGL_VERSION_MINOR: + case GLFW_CONTEXT_VERSION_MINOR: _glfwLibrary.hints.glMinor = hint; break; + case GLFW_CONTEXT_ROBUSTNESS: + _glfwLibrary.hints.glRobustness = hint; + break; case GLFW_OPENGL_FORWARD_COMPAT: _glfwLibrary.hints.glForward = hint; break; @@ -462,9 +465,6 @@ GLFWAPI void glfwWindowHint(int target, int hint) case GLFW_OPENGL_PROFILE: _glfwLibrary.hints.glProfile = hint; break; - case GLFW_OPENGL_ROBUSTNESS: - _glfwLibrary.hints.glRobustness = hint; - break; default: _glfwSetError(GLFW_INVALID_ENUM, NULL); break; @@ -711,20 +711,20 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param) return window->positionY; case GLFW_CLIENT_API: return window->clientAPI; - case GLFW_OPENGL_VERSION_MAJOR: + case GLFW_CONTEXT_VERSION_MAJOR: return window->glMajor; - case GLFW_OPENGL_VERSION_MINOR: + case GLFW_CONTEXT_VERSION_MINOR: return window->glMinor; - case GLFW_OPENGL_REVISION: + case GLFW_CONTEXT_REVISION: return window->glRevision; + case GLFW_CONTEXT_ROBUSTNESS: + return window->glRobustness; case GLFW_OPENGL_FORWARD_COMPAT: return window->glForward; case GLFW_OPENGL_DEBUG_CONTEXT: return window->glDebug; case GLFW_OPENGL_PROFILE: return window->glProfile; - case GLFW_OPENGL_ROBUSTNESS: - return window->glRobustness; } _glfwSetError(GLFW_INVALID_ENUM, NULL); diff --git a/tests/defaults.c b/tests/defaults.c index cd576f3d..211071d9 100644 --- a/tests/defaults.c +++ b/tests/defaults.c @@ -64,8 +64,8 @@ static ParamGL gl_params[] = static ParamGLFW glfw_params[] = { { GLFW_REFRESH_RATE, "refresh rate" }, - { GLFW_OPENGL_VERSION_MAJOR, "OpenGL major" }, - { GLFW_OPENGL_VERSION_MINOR, "OpenGL minor" }, + { GLFW_CONTEXT_VERSION_MAJOR, "Context version major" }, + { GLFW_CONTEXT_VERSION_MINOR, "Context version minor" }, { GLFW_OPENGL_FORWARD_COMPAT, "OpenGL forward compatible" }, { GLFW_OPENGL_DEBUG_CONTEXT, "OpenGL debug context" }, { GLFW_OPENGL_PROFILE, "OpenGL profile" }, diff --git a/tests/glfwinfo.c b/tests/glfwinfo.c index b3e0474c..3ac01800 100644 --- a/tests/glfwinfo.c +++ b/tests/glfwinfo.c @@ -214,9 +214,9 @@ int main(int argc, char** argv) break; case 'r': if (strcasecmp(optarg, STRATEGY_NAME_NONE) == 0) - strategy = GLFW_OPENGL_NO_RESET_NOTIFICATION; + strategy = GLFW_NO_RESET_NOTIFICATION; else if (strcasecmp(optarg, STRATEGY_NAME_LOSE) == 0) - strategy = GLFW_OPENGL_LOSE_CONTEXT_ON_RESET; + strategy = GLFW_LOSE_CONTEXT_ON_RESET; else { usage(); @@ -244,8 +244,8 @@ int main(int argc, char** argv) if (major != 1 || minor != 0) { - glfwWindowHint(GLFW_OPENGL_VERSION_MAJOR, major); - glfwWindowHint(GLFW_OPENGL_VERSION_MINOR, minor); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, major); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, minor); } if (api != 0) @@ -261,7 +261,7 @@ int main(int argc, char** argv) glfwWindowHint(GLFW_OPENGL_PROFILE, profile); if (strategy) - glfwWindowHint(GLFW_OPENGL_ROBUSTNESS, strategy); + glfwWindowHint(GLFW_CONTEXT_ROBUSTNESS, strategy); glfwWindowHint(GLFW_VISIBLE, GL_FALSE); @@ -280,9 +280,9 @@ int main(int argc, char** argv) // Report client API version api = glfwGetWindowParam(window, GLFW_CLIENT_API); - major = glfwGetWindowParam(window, GLFW_OPENGL_VERSION_MAJOR); - minor = glfwGetWindowParam(window, GLFW_OPENGL_VERSION_MINOR); - revision = glfwGetWindowParam(window, GLFW_OPENGL_REVISION); + major = glfwGetWindowParam(window, GLFW_CONTEXT_VERSION_MAJOR); + minor = glfwGetWindowParam(window, GLFW_CONTEXT_VERSION_MINOR); + revision = glfwGetWindowParam(window, GLFW_CONTEXT_REVISION); printf("%s context version string: \"%s\"\n", get_client_api_name(api),