mirror of
https://github.com/glfw/glfw.git
synced 2024-11-11 13:03:52 +00:00
Merge branch 'master' into EGL
Conflicts: readme.html src/win32_platform.h src/x11_platform.h
This commit is contained in:
commit
da02844457
@ -522,6 +522,10 @@ extern "C" {
|
|||||||
/*! @brief The number of samples used for default framebuffer multisampling.
|
/*! @brief The number of samples used for default framebuffer multisampling.
|
||||||
*/
|
*/
|
||||||
#define GLFW_FSAA_SAMPLES 0x0002100E
|
#define GLFW_FSAA_SAMPLES 0x0002100E
|
||||||
|
/*! @brief @c GL_TRUE if the framebuffer should be sRGB capable, or @c GL_FALSE
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
#define GLFW_SRGB_CAPABLE 0x0002100F
|
||||||
|
|
||||||
/*! @brief The @link clients client API @endlink to create a context for.
|
/*! @brief The @link clients client API @endlink to create a context for.
|
||||||
*/
|
*/
|
||||||
@ -710,6 +714,16 @@ typedef void* GLFWwindow;
|
|||||||
*/
|
*/
|
||||||
typedef void (* GLFWerrorfun)(int,const char*);
|
typedef void (* GLFWerrorfun)(int,const char*);
|
||||||
|
|
||||||
|
/*! @brief The function signature for window position callbacks.
|
||||||
|
* @param[in] window The window that the user moved.
|
||||||
|
* @param[in] x The new x-coordinate, in pixels, of the upper-left corner of
|
||||||
|
* the client area of the window.
|
||||||
|
* @param[in] y The new y-coordinate, in pixels, of the upper-left corner of
|
||||||
|
* the client area of the window.
|
||||||
|
* @ingroup window
|
||||||
|
*/
|
||||||
|
typedef void (* GLFWwindowposfun)(GLFWwindow,int,int);
|
||||||
|
|
||||||
/*! @brief The function signature for window resize callbacks.
|
/*! @brief The function signature for window resize callbacks.
|
||||||
* @param[in] window The window that the user resized.
|
* @param[in] window The window that the user resized.
|
||||||
* @param[in] width The new width, in pixels, of the window.
|
* @param[in] width The new width, in pixels, of the window.
|
||||||
@ -948,7 +962,7 @@ GLFWAPI void glfwGetDesktopMode(GLFWvidmode* mode);
|
|||||||
|
|
||||||
/*! @brief Sets the system gamma ramp to one generated from the specified
|
/*! @brief Sets the system gamma ramp to one generated from the specified
|
||||||
* exponent.
|
* exponent.
|
||||||
* @param[in] The desired exponent.
|
* @param[in] gamma The desired exponent.
|
||||||
* @ingroup gamma
|
* @ingroup gamma
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetGamma(float gamma);
|
GLFWAPI void glfwSetGamma(float gamma);
|
||||||
@ -1014,6 +1028,9 @@ GLFWAPI void glfwDefaultWindowHints(void);
|
|||||||
* The @ref GLFW_FSAA_SAMPLES hint specifies the desired number of samples to
|
* The @ref GLFW_FSAA_SAMPLES hint specifies the desired number of samples to
|
||||||
* use for multisampling.
|
* use for multisampling.
|
||||||
*
|
*
|
||||||
|
* The @ref GLFW_SRGB_CAPABLE hint specifies whether the framebuffer should be
|
||||||
|
* sRGB capable.
|
||||||
|
*
|
||||||
* The @ref GLFW_CLIENT_API hint specifies which client API to create the
|
* The @ref GLFW_CLIENT_API hint specifies which client API to create the
|
||||||
* context for. Possible values are @ref GLFW_OPENGL_API and @ref
|
* context for. Possible values are @ref GLFW_OPENGL_API and @ref
|
||||||
* GLFW_OPENGL_ES_API.
|
* GLFW_OPENGL_ES_API.
|
||||||
@ -1042,7 +1059,8 @@ GLFWAPI void glfwDefaultWindowHints(void);
|
|||||||
* used by the OpenGL context.
|
* used by the OpenGL context.
|
||||||
*
|
*
|
||||||
* The @ref GLFW_RESIZABLE hint specifies whether the window will be resizable
|
* The @ref GLFW_RESIZABLE hint specifies whether the window will be resizable
|
||||||
* by the user. This hint is ignored for fullscreen windows.
|
* by the user. The window will still be resizable using the @ref
|
||||||
|
* glfwSetWindowSize function. This hint is ignored for fullscreen windows.
|
||||||
*
|
*
|
||||||
* The @ref GLFW_VISIBLE hint specifies whether the window will be initially
|
* The @ref GLFW_VISIBLE hint specifies whether the window will be initially
|
||||||
* visible. This hint is ignored for fullscreen windows.
|
* visible. This hint is ignored for fullscreen windows.
|
||||||
@ -1053,7 +1071,9 @@ GLFWAPI void glfwDefaultWindowHints(void);
|
|||||||
* Some window hints are hard constraints. These must match the available
|
* Some window hints are hard constraints. These must match the available
|
||||||
* capabilities @em exactly for window and context creation to succeed. Hints
|
* capabilities @em exactly for window and context creation to succeed. Hints
|
||||||
* that are not hard constraints are matched as closely as possible, but the
|
* that are not hard constraints are matched as closely as possible, but the
|
||||||
* resulting window and context may differ from what these hints requested.
|
* resulting window and context may differ from what these hints requested. To
|
||||||
|
* find out the actual properties of the created window and context, use the
|
||||||
|
* @ref glfwGetWindowParam function.
|
||||||
*
|
*
|
||||||
* The following window hints are hard constraints:
|
* The following window hints are hard constraints:
|
||||||
* @arg @ref GLFW_STEREO
|
* @arg @ref GLFW_STEREO
|
||||||
@ -1278,11 +1298,21 @@ GLFWAPI void glfwSetWindowUserPointer(GLFWwindow window, void* pointer);
|
|||||||
*/
|
*/
|
||||||
GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow window);
|
GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow window);
|
||||||
|
|
||||||
|
/*! @brief Sets the position callback for the specified window.
|
||||||
|
* @param[in] window The window whose callback to set.
|
||||||
|
* @param[in] cbfun The new callback, or @c NULL to remove the currently set
|
||||||
|
* callback.
|
||||||
|
* @ingroup window
|
||||||
|
*/
|
||||||
|
GLFWAPI void glfwSetWindowPosCallback(GLFWwindow window, GLFWwindowposfun cbfun);
|
||||||
|
|
||||||
/*! @brief Sets the size callback for the specified window.
|
/*! @brief Sets the size callback for the specified window.
|
||||||
* @param[in] window The window whose callback to set.
|
* @param[in] window The window whose callback to set.
|
||||||
* @param[in] cbfun The new callback, or @c NULL to remove the currently set
|
* @param[in] cbfun The new callback, or @c NULL to remove the currently set
|
||||||
* callback.
|
* callback.
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
|
*
|
||||||
|
* This callback is called when the window is resized.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow window, GLFWwindowsizefun cbfun);
|
GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow window, GLFWwindowsizefun cbfun);
|
||||||
|
|
||||||
@ -1291,6 +1321,14 @@ GLFWAPI void glfwSetWindowSizeCallback(GLFWwindow window, GLFWwindowsizefun cbfu
|
|||||||
* @param[in] cbfun The new callback, or @c NULL to remove the currently set
|
* @param[in] cbfun The new callback, or @c NULL to remove the currently set
|
||||||
* callback.
|
* callback.
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
|
*
|
||||||
|
* This callback is called when the user attempts to close the window, i.e.
|
||||||
|
* clicks the window's close widget or, on Mac OS X, selects @b Quit from the
|
||||||
|
* application menu. Calling @ref glfwDestroyWindow does not cause this
|
||||||
|
* callback to be called.
|
||||||
|
*
|
||||||
|
* The return value of the close callback becomes the new value of the @ref
|
||||||
|
* GLFW_CLOSE_REQUESTED window parameter.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow window, GLFWwindowclosefun cbfun);
|
GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow window, GLFWwindowclosefun cbfun);
|
||||||
|
|
||||||
@ -1299,6 +1337,13 @@ GLFWAPI void glfwSetWindowCloseCallback(GLFWwindow window, GLFWwindowclosefun cb
|
|||||||
* @param[in] cbfun The new callback, or @c NULL to remove the currently set
|
* @param[in] cbfun The new callback, or @c NULL to remove the currently set
|
||||||
* callback.
|
* callback.
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
|
*
|
||||||
|
* This callback is called when the client area of the window needs to be
|
||||||
|
* redrawn, for example if the window has been exposed after having been
|
||||||
|
* covered by another window.
|
||||||
|
*
|
||||||
|
* @note On compositing window systems such as Mac OS X, where the window
|
||||||
|
* contents are saved off-screen, this callback may never be called.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow window, GLFWwindowrefreshfun cbfun);
|
GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow window, GLFWwindowrefreshfun cbfun);
|
||||||
|
|
||||||
@ -1307,6 +1352,8 @@ GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow window, GLFWwindowrefreshfu
|
|||||||
* @param[in] cbfun The new callback, or @c NULL to remove the currently set
|
* @param[in] cbfun The new callback, or @c NULL to remove the currently set
|
||||||
* callback.
|
* callback.
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
|
*
|
||||||
|
* This callback is called when the window gains or loses focus.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow window, GLFWwindowfocusfun cbfun);
|
GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow window, GLFWwindowfocusfun cbfun);
|
||||||
|
|
||||||
@ -1315,6 +1362,8 @@ GLFWAPI void glfwSetWindowFocusCallback(GLFWwindow window, GLFWwindowfocusfun cb
|
|||||||
* @param[in] cbfun The new callback, or @c NULL to remove the currently set
|
* @param[in] cbfun The new callback, or @c NULL to remove the currently set
|
||||||
* callback.
|
* callback.
|
||||||
* @ingroup window
|
* @ingroup window
|
||||||
|
*
|
||||||
|
* This callback is called when the window is iconified or restored.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow window, GLFWwindowiconifyfun cbfun);
|
GLFWAPI void glfwSetWindowIconifyCallback(GLFWwindow window, GLFWwindowiconifyfun cbfun);
|
||||||
|
|
||||||
@ -1413,7 +1462,7 @@ GLFWAPI void glfwGetScrollOffset(GLFWwindow window, double* xoffset, double* yof
|
|||||||
* set callback.
|
* set callback.
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*
|
*
|
||||||
* @note The key callback deals with physical keys, with @link keys tokens
|
* @remarks The key callback deals with physical keys, with @link keys tokens
|
||||||
* @endlink named after their use on the standard US keyboard layout. If you
|
* @endlink named after their use on the standard US keyboard layout. If you
|
||||||
* want to input text, use the Unicode character callback instead.
|
* want to input text, use the Unicode character callback instead.
|
||||||
*/
|
*/
|
||||||
@ -1424,8 +1473,8 @@ GLFWAPI void glfwSetKeyCallback(GLFWwindow window, GLFWkeyfun cbfun);
|
|||||||
* the currently set callback.
|
* the currently set callback.
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
*
|
*
|
||||||
* @note The Unicode character callback is for text input. If you want to know
|
* @remarks The Unicode character callback is for text input. If you want to
|
||||||
* whether a specific key was pressed or released, use the key callback.
|
* know whether a specific key was pressed or released, use the key callback.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetCharCallback(GLFWwindow window, GLFWcharfun cbfun);
|
GLFWAPI void glfwSetCharCallback(GLFWwindow window, GLFWcharfun cbfun);
|
||||||
|
|
||||||
@ -1440,6 +1489,9 @@ GLFWAPI void glfwSetMouseButtonCallback(GLFWwindow window, GLFWmousebuttonfun cb
|
|||||||
* @param[in] cbfun The new cursor position callback, or @c NULL to remove the
|
* @param[in] cbfun The new cursor position callback, or @c NULL to remove the
|
||||||
* currently set callback.
|
* currently set callback.
|
||||||
* @ingroup input
|
* @ingroup input
|
||||||
|
*
|
||||||
|
* @remarks The position is relative to the upper-left corner of the client
|
||||||
|
* area of the window.
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetCursorPosCallback(GLFWwindow window, GLFWcursorposfun cbfun);
|
GLFWAPI void glfwSetCursorPosCallback(GLFWwindow window, GLFWcursorposfun cbfun);
|
||||||
|
|
||||||
@ -1492,6 +1544,8 @@ GLFWAPI int glfwGetJoystickButtons(int joy, unsigned char* buttons, int numbutto
|
|||||||
* @param[in] string A UTF-8 encoded string.
|
* @param[in] string A UTF-8 encoded string.
|
||||||
* @ingroup clipboard
|
* @ingroup clipboard
|
||||||
*
|
*
|
||||||
|
* @note This function may only be called from the main thread.
|
||||||
|
*
|
||||||
* @sa glfwGetClipboardString
|
* @sa glfwGetClipboardString
|
||||||
*/
|
*/
|
||||||
GLFWAPI void glfwSetClipboardString(GLFWwindow window, const char* string);
|
GLFWAPI void glfwSetClipboardString(GLFWwindow window, const char* string);
|
||||||
@ -1502,6 +1556,8 @@ GLFWAPI void glfwSetClipboardString(GLFWwindow window, const char* string);
|
|||||||
* if that format was unavailable.
|
* if that format was unavailable.
|
||||||
* @ingroup clipboard
|
* @ingroup clipboard
|
||||||
*
|
*
|
||||||
|
* @note This function may only be called from the main thread.
|
||||||
|
*
|
||||||
* @note The returned string is valid only until the next call to @ref
|
* @note The returned string is valid only until the next call to @ref
|
||||||
* glfwGetClipboardString or @ref glfwSetClipboardString.
|
* glfwGetClipboardString or @ref glfwSetClipboardString.
|
||||||
*
|
*
|
||||||
|
@ -274,17 +274,19 @@ version of GLFW.</p>
|
|||||||
<li>Added <code>glfwSetErrorCallback</code> function and <code>GLFWerrorfun</code> type for receiving more specific and/or nested errors</li>
|
<li>Added <code>glfwSetErrorCallback</code> function and <code>GLFWerrorfun</code> type for receiving more specific and/or nested errors</li>
|
||||||
<li>Added <code>glfwSetWindowUserPointer</code> and <code>glfwGetWindowUserPointer</code> functions for per-window user pointers</li>
|
<li>Added <code>glfwSetWindowUserPointer</code> and <code>glfwGetWindowUserPointer</code> functions for per-window user pointers</li>
|
||||||
<li>Added <code>glfwGetVersionString</code> function for determining which code paths were enabled at compile time</li>
|
<li>Added <code>glfwGetVersionString</code> function for determining which code paths were enabled at compile time</li>
|
||||||
<li>Added <code>glfwGetWindowPos</code> function for querying the position of the specified window</li>
|
<li>Added <code>glfwSetWindowPosCallback</code> function and <code>GLFWwindowposfun</code> type for reciving window position events</li>
|
||||||
<li>Added <code>glfwSetWindowFocusCallback</code> function and <code>GLFWwindowfocusfun</code> type for receiving window focus events</li>
|
<li>Added <code>glfwSetWindowFocusCallback</code> function and <code>GLFWwindowfocusfun</code> type for receiving window focus events</li>
|
||||||
<li>Added <code>glfwSetWindowIconifyCallback</code> function and <code>GLFWwindowiconifyfun</code> type for receiving window iconification events</li>
|
<li>Added <code>glfwSetWindowIconifyCallback</code> function and <code>GLFWwindowiconifyfun</code> type for receiving window iconification events</li>
|
||||||
<li>Added <code>glfwGetClipboardString</code> and <code>glfwSetClipboardString</code> functions for interacting with the system clipboard</li>
|
<li>Added <code>glfwGetClipboardString</code> and <code>glfwSetClipboardString</code> functions for interacting with the system clipboard</li>
|
||||||
<li>Added <code>glfwGetCurrentContext</code> function for retrieving the window whose OpenGL context is current</li>
|
<li>Added <code>glfwGetCurrentContext</code> function for retrieving the window whose OpenGL context is current</li>
|
||||||
<li>Added <code>GLFW_CLIENT_API</code> window hint for creating contexts for APIs other than desktop OpenGL</li>
|
<li>Added <code>GLFW_SRGB_CAPABLE</code> for requesting sRGB capable framebuffers</li>
|
||||||
|
<li>Added <code>GLFW_CLIENT_API</code>, <code>GLFW_OPENGL_API</code> and <code>GLFW_OPENGL_ES_API</code> for selecting client API</li>
|
||||||
<li>Added <code>GLFW_OPENGL_ROBUSTNESS</code> window hint and associated strategy tokens for <code>GL_ARB_robustness</code> support</li>
|
<li>Added <code>GLFW_OPENGL_ROBUSTNESS</code> window hint and associated strategy tokens for <code>GL_ARB_robustness</code> support</li>
|
||||||
<li>Added <code>GLFW_OPENGL_REVISION</code> window parameter to make up for removal of <code>glfwGetGLVersion</code></li>
|
<li>Added <code>GLFW_OPENGL_REVISION</code> window parameter to make up for removal of <code>glfwGetGLVersion</code></li>
|
||||||
<li>Added <code>GLFW_INCLUDE_GLCOREARB</code> macro for including <code>glcorearb.h</code> instead of <code>gl.h</code></li>
|
<li>Added <code>GLFW_INCLUDE_GLCOREARB</code> macro for including <code>glcorearb.h</code> instead of <code>gl.h</code></li>
|
||||||
<li>Added <code>GLFW_INCLUDE_ES2</code> macro for telling the GLFW header to include the OpenGL ES 2.0 header instead of <code>gl.h</code></li>
|
<li>Added <code>GLFW_INCLUDE_ES2</code> macro for telling the GLFW header to include the OpenGL ES 2.0 header instead of <code>gl.h</code></li>
|
||||||
<li>Added <code>GLFW_VISIBLE</code> window hint and parameter for controlling and polling window visibility</li>
|
<li>Added <code>GLFW_VISIBLE</code> window hint and parameter for controlling and polling window visibility</li>
|
||||||
|
<li>Added <code>GLFW_POSITION_X</code> and <code>GLFW_POSITION_Y</code> window hints and parameter for controlling and polling window position</li>
|
||||||
<li>Added <code>windows</code> simple multi-window test program</li>
|
<li>Added <code>windows</code> simple multi-window test program</li>
|
||||||
<li>Added <code>sharing</code> simple OpenGL object sharing test program</li>
|
<li>Added <code>sharing</code> simple OpenGL object sharing test program</li>
|
||||||
<li>Added <code>modes</code> video mode enumeration and setting test program</li>
|
<li>Added <code>modes</code> video mode enumeration and setting test program</li>
|
||||||
|
@ -835,6 +835,9 @@ static GLboolean createContext(_GLFWwindow* window,
|
|||||||
ADD_ATTR2(NSOpenGLPFASamples, fbconfig->samples);
|
ADD_ATTR2(NSOpenGLPFASamples, fbconfig->samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: All NSOpenGLPixelFormats on the relevant cards support sRGB
|
||||||
|
// frambuffer, so there's no need (and no way) to request it
|
||||||
|
|
||||||
ADD_ATTR(0);
|
ADD_ATTR(0);
|
||||||
|
|
||||||
#undef ADD_ATTR
|
#undef ADD_ATTR
|
||||||
|
@ -218,6 +218,12 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
|||||||
extraDiff += (desired->samples - current->samples) *
|
extraDiff += (desired->samples - current->samples) *
|
||||||
(desired->samples - current->samples);
|
(desired->samples - current->samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (desired->sRGB)
|
||||||
|
{
|
||||||
|
if (!current->sRGB)
|
||||||
|
extraDiff++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Figure out if the current one is better than the best one found so far
|
// Figure out if the current one is better than the best one found so far
|
||||||
|
@ -190,6 +190,11 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
|||||||
else
|
else
|
||||||
f->samples = 0;
|
f->samples = 0;
|
||||||
|
|
||||||
|
if (_glfwLibrary.GLX.ARB_framebuffer_sRGB)
|
||||||
|
f->sRGB = getFBConfigAttrib(window, fbconfigs[i], GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB);
|
||||||
|
else
|
||||||
|
f->sRGB = GL_FALSE;
|
||||||
|
|
||||||
f->platformID = (GLFWintptr) getFBConfigAttrib(window, fbconfigs[i], GLX_FBCONFIG_ID);
|
f->platformID = (GLFWintptr) getFBConfigAttrib(window, fbconfigs[i], GLX_FBCONFIG_ID);
|
||||||
|
|
||||||
(*found)++;
|
(*found)++;
|
||||||
@ -527,6 +532,9 @@ int _glfwInitOpenGL(void)
|
|||||||
if (_glfwPlatformExtensionSupported("GLX_ARB_multisample"))
|
if (_glfwPlatformExtensionSupported("GLX_ARB_multisample"))
|
||||||
_glfwLibrary.GLX.ARB_multisample = GL_TRUE;
|
_glfwLibrary.GLX.ARB_multisample = GL_TRUE;
|
||||||
|
|
||||||
|
if (_glfwPlatformExtensionSupported("GLX_ARB_framebuffer_sRGB"))
|
||||||
|
_glfwLibrary.GLX.ARB_framebuffer_sRGB = GL_TRUE;
|
||||||
|
|
||||||
if (_glfwPlatformExtensionSupported("GLX_ARB_create_context"))
|
if (_glfwPlatformExtensionSupported("GLX_ARB_create_context"))
|
||||||
{
|
{
|
||||||
_glfwLibrary.GLX.CreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
|
_glfwLibrary.GLX.CreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
|
||||||
|
@ -105,6 +105,7 @@ typedef struct _GLFWlibraryGLX
|
|||||||
GLboolean EXT_swap_control;
|
GLboolean EXT_swap_control;
|
||||||
GLboolean MESA_swap_control;
|
GLboolean MESA_swap_control;
|
||||||
GLboolean ARB_multisample;
|
GLboolean ARB_multisample;
|
||||||
|
GLboolean ARB_framebuffer_sRGB;
|
||||||
GLboolean ARB_create_context;
|
GLboolean ARB_create_context;
|
||||||
GLboolean ARB_create_context_profile;
|
GLboolean ARB_create_context_profile;
|
||||||
GLboolean ARB_create_context_robustness;
|
GLboolean ARB_create_context_robustness;
|
||||||
|
@ -100,6 +100,7 @@ struct _GLFWhints
|
|||||||
GLboolean resizable;
|
GLboolean resizable;
|
||||||
GLboolean visible;
|
GLboolean visible;
|
||||||
int samples;
|
int samples;
|
||||||
|
GLboolean sRGB;
|
||||||
int clientAPI;
|
int clientAPI;
|
||||||
int glMajor;
|
int glMajor;
|
||||||
int glMinor;
|
int glMinor;
|
||||||
@ -160,6 +161,7 @@ struct _GLFWfbconfig
|
|||||||
int auxBuffers;
|
int auxBuffers;
|
||||||
GLboolean stereo;
|
GLboolean stereo;
|
||||||
int samples;
|
int samples;
|
||||||
|
GLboolean sRGB;
|
||||||
GLFWintptr platformID;
|
GLFWintptr platformID;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -199,6 +201,7 @@ struct _GLFWwindow
|
|||||||
int glRobustness;
|
int glRobustness;
|
||||||
PFNGLGETSTRINGIPROC GetStringi;
|
PFNGLGETSTRINGIPROC GetStringi;
|
||||||
|
|
||||||
|
GLFWwindowposfun windowPosCallback;
|
||||||
GLFWwindowsizefun windowSizeCallback;
|
GLFWwindowsizefun windowSizeCallback;
|
||||||
GLFWwindowclosefun windowCloseCallback;
|
GLFWwindowclosefun windowCloseCallback;
|
||||||
GLFWwindowrefreshfun windowRefreshCallback;
|
GLFWwindowrefreshfun windowRefreshCallback;
|
||||||
|
@ -72,6 +72,7 @@ static void initWGLExtensions(_GLFWwindow* window)
|
|||||||
// This needs to include every extension used below except for
|
// This needs to include every extension used below except for
|
||||||
// WGL_ARB_extensions_string and WGL_EXT_extensions_string
|
// WGL_ARB_extensions_string and WGL_EXT_extensions_string
|
||||||
window->WGL.ARB_multisample = GL_FALSE;
|
window->WGL.ARB_multisample = GL_FALSE;
|
||||||
|
window->WGL.ARB_framebuffer_sRGB = GL_FALSE;
|
||||||
window->WGL.ARB_create_context = GL_FALSE;
|
window->WGL.ARB_create_context = GL_FALSE;
|
||||||
window->WGL.ARB_create_context_profile = GL_FALSE;
|
window->WGL.ARB_create_context_profile = GL_FALSE;
|
||||||
window->WGL.EXT_create_context_es2_profile = GL_FALSE;
|
window->WGL.EXT_create_context_es2_profile = GL_FALSE;
|
||||||
@ -92,6 +93,9 @@ static void initWGLExtensions(_GLFWwindow* window)
|
|||||||
if (_glfwPlatformExtensionSupported("WGL_ARB_multisample"))
|
if (_glfwPlatformExtensionSupported("WGL_ARB_multisample"))
|
||||||
window->WGL.ARB_multisample = GL_TRUE;
|
window->WGL.ARB_multisample = GL_TRUE;
|
||||||
|
|
||||||
|
if (_glfwPlatformExtensionSupported("WGL_ARB_framebuffer_sRGB"))
|
||||||
|
window->WGL.ARB_framebuffer_sRGB = GL_TRUE;
|
||||||
|
|
||||||
if (_glfwPlatformExtensionSupported("WGL_ARB_create_context"))
|
if (_glfwPlatformExtensionSupported("WGL_ARB_create_context"))
|
||||||
{
|
{
|
||||||
window->WGL.CreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)
|
window->WGL.CreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)
|
||||||
@ -246,6 +250,11 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
|||||||
f->samples = getPixelFormatAttrib(window, i, WGL_SAMPLES_ARB);
|
f->samples = getPixelFormatAttrib(window, i, WGL_SAMPLES_ARB);
|
||||||
else
|
else
|
||||||
f->samples = 0;
|
f->samples = 0;
|
||||||
|
|
||||||
|
if (window->WGL.ARB_framebuffer_sRGB)
|
||||||
|
f->sRGB = getPixelFormatAttrib(window, i, WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
|
||||||
|
else
|
||||||
|
f->sRGB = GL_FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -293,6 +302,9 @@ static _GLFWfbconfig* getFBConfigs(_GLFWwindow* window, unsigned int* found)
|
|||||||
|
|
||||||
// PFD pixel formats do not support FSAA
|
// PFD pixel formats do not support FSAA
|
||||||
f->samples = 0;
|
f->samples = 0;
|
||||||
|
|
||||||
|
// PFD pixel formats do not support sRGB
|
||||||
|
f->sRGB = GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
f->platformID = i;
|
f->platformID = i;
|
||||||
|
@ -62,6 +62,7 @@ typedef struct _GLFWcontextWGL
|
|||||||
PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB;
|
PFNWGLCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB;
|
||||||
GLboolean EXT_swap_control;
|
GLboolean EXT_swap_control;
|
||||||
GLboolean ARB_multisample;
|
GLboolean ARB_multisample;
|
||||||
|
GLboolean ARB_framebuffer_sRGB;
|
||||||
GLboolean ARB_pixel_format;
|
GLboolean ARB_pixel_format;
|
||||||
GLboolean ARB_create_context;
|
GLboolean ARB_create_context;
|
||||||
GLboolean ARB_create_context_profile;
|
GLboolean ARB_create_context_profile;
|
||||||
|
28
src/window.c
28
src/window.c
@ -119,8 +119,14 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused)
|
|||||||
|
|
||||||
void _glfwInputWindowPos(_GLFWwindow* window, int x, int y)
|
void _glfwInputWindowPos(_GLFWwindow* window, int x, int y)
|
||||||
{
|
{
|
||||||
|
if (window->positionX == x && window->positionY == y)
|
||||||
|
return;
|
||||||
|
|
||||||
window->positionX = x;
|
window->positionX = x;
|
||||||
window->positionY = y;
|
window->positionY = y;
|
||||||
|
|
||||||
|
if (window->windowPosCallback)
|
||||||
|
window->windowPosCallback(window, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -231,6 +237,7 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||||||
fbconfig.auxBuffers = Max(_glfwLibrary.hints.auxBuffers, 0);
|
fbconfig.auxBuffers = Max(_glfwLibrary.hints.auxBuffers, 0);
|
||||||
fbconfig.stereo = _glfwLibrary.hints.stereo ? GL_TRUE : GL_FALSE;
|
fbconfig.stereo = _glfwLibrary.hints.stereo ? GL_TRUE : GL_FALSE;
|
||||||
fbconfig.samples = Max(_glfwLibrary.hints.samples, 0);
|
fbconfig.samples = Max(_glfwLibrary.hints.samples, 0);
|
||||||
|
fbconfig.sRGB = _glfwLibrary.hints.sRGB ? GL_TRUE : GL_FALSE;
|
||||||
|
|
||||||
// Set up desired window config
|
// Set up desired window config
|
||||||
wndconfig.mode = mode;
|
wndconfig.mode = mode;
|
||||||
@ -440,6 +447,9 @@ GLFWAPI void glfwWindowHint(int target, int hint)
|
|||||||
case GLFW_FSAA_SAMPLES:
|
case GLFW_FSAA_SAMPLES:
|
||||||
_glfwLibrary.hints.samples = hint;
|
_glfwLibrary.hints.samples = hint;
|
||||||
break;
|
break;
|
||||||
|
case GLFW_SRGB_CAPABLE:
|
||||||
|
_glfwLibrary.hints.sRGB = hint;
|
||||||
|
break;
|
||||||
case GLFW_CLIENT_API:
|
case GLFW_CLIENT_API:
|
||||||
_glfwLibrary.hints.clientAPI = hint;
|
_glfwLibrary.hints.clientAPI = hint;
|
||||||
break;
|
break;
|
||||||
@ -764,6 +774,24 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//========================================================================
|
||||||
|
// Set callback function for window position changes
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
GLFWAPI void glfwSetWindowPosCallback(GLFWwindow handle, GLFWwindowposfun cbfun)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
|
if (!_glfwInitialized)
|
||||||
|
{
|
||||||
|
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window->windowPosCallback = cbfun;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Set callback function for window size changes
|
// Set callback function for window size changes
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
@ -218,6 +218,15 @@ static const char* get_character_string(int character)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void window_pos_callback(GLFWwindow window, int x, int y)
|
||||||
|
{
|
||||||
|
printf("%08x at %0.3f: Window position: %i %i\n",
|
||||||
|
counter++,
|
||||||
|
glfwGetTime(),
|
||||||
|
x,
|
||||||
|
y);
|
||||||
|
}
|
||||||
|
|
||||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
static void window_size_callback(GLFWwindow window, int width, int height)
|
||||||
{
|
{
|
||||||
printf("%08x at %0.3f: Window size: %i %i\n",
|
printf("%08x at %0.3f: Window size: %i %i\n",
|
||||||
@ -354,6 +363,7 @@ int main(void)
|
|||||||
|
|
||||||
printf("Window opened\n");
|
printf("Window opened\n");
|
||||||
|
|
||||||
|
glfwSetWindowPosCallback(window, window_pos_callback);
|
||||||
glfwSetWindowSizeCallback(window, window_size_callback);
|
glfwSetWindowSizeCallback(window, window_size_callback);
|
||||||
glfwSetWindowCloseCallback(window, window_close_callback);
|
glfwSetWindowCloseCallback(window, window_close_callback);
|
||||||
glfwSetWindowRefreshCallback(window, window_refresh_callback);
|
glfwSetWindowRefreshCallback(window, window_refresh_callback);
|
||||||
|
Loading…
Reference in New Issue
Block a user