Added support for GLX_MESA_swap_interval.

This commit is contained in:
Camilla Berglund 2012-07-15 16:48:39 +02:00
parent 34c93a5124
commit aa328c0bbd
3 changed files with 23 additions and 3 deletions

View File

@ -335,7 +335,7 @@ version of GLFW.</p>
<li>[Cocoa] Bugfix: The cursor position incorrectly rounded during conversion</li>
<li>[Cocoa] Bugfix: Cursor positioning led to nonsensical results for fullscreen windows</li>
<li>[Cocoa] Bugfix: The GLFW window was flagged as restorable</li>
<li>[X11] Added support for the <code>GLX_EXT_swap_control</code> extension as an alternative to <code>GLX_SGI_swap_control</code></li>
<li>[X11] Added support for the <code>GLX_EXT_swap_control</code> and <code>GLX_MESA_swap_control</code> extensions as alternatives to <code>GLX_SGI_swap_control</code></li>
<li>[X11] Added the POSIX <code>CLOCK_MONOTONIC</code> time source as the preferred method</li>
<li>[X11] Added dependency on libm, where present</li>
<li>[X11] Added support for the <code>_NET_WM_NAME</code> and <code>_NET_WM_ICON_NAME</code> EWMH window properties</li>

View File

@ -544,6 +544,15 @@ int _glfwInitOpenGL(void)
_glfwLibrary.GLX.SGI_swap_control = GL_TRUE;
}
if (_glfwPlatformExtensionSupported("GLX_MESA_swap_control"))
{
window->GLX.SwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)
_glfwPlatformGetProcAddress("glXSwapIntervalMESA");
if (window->GLX.SwapIntervalMESA)
window->GLX.MESA_swap_control = GL_TRUE;
}
if (_glfwPlatformExtensionSupported("GLX_SGIX_fbconfig"))
{
_glfwLibrary.GLX.GetFBConfigAttribSGIX = (PFNGLXGETFBCONFIGATTRIBSGIXPROC)
@ -722,8 +731,13 @@ void _glfwPlatformSwapInterval(int interval)
window->X11.handle,
interval);
}
else if (_glfwLibrary.GLX.SGI_swap_control)
_glfwLibrary.GLX.SwapIntervalSGI(interval);
else if (window->GLX.MESA_swap_control)
window->GLX.SwapIntervalMESA(interval);
else if (window->GLX.SGI_swap_control)
{
if (interval > 0)
window->GLX.SwapIntervalSGI(interval);
}
}

View File

@ -97,6 +97,10 @@
#define _GLFW_CONVERSION_SUCCEEDED 1
#define _GLFW_CONVERSION_FAILED 2
#ifndef GLX_MESA_swap_control
typedef int (*PFNGLXSWAPINTERVALMESAPROC)(int);
#endif
//========================================================================
// GLFW platform specific types
@ -242,6 +246,7 @@ typedef struct _GLFWlibraryGLX
// GLX extensions
PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI;
PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT;
PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA;
PFNGLXGETFBCONFIGATTRIBSGIXPROC GetFBConfigAttribSGIX;
PFNGLXCHOOSEFBCONFIGSGIXPROC ChooseFBConfigSGIX;
PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC CreateContextWithConfigSGIX;
@ -250,6 +255,7 @@ typedef struct _GLFWlibraryGLX
GLboolean SGIX_fbconfig;
GLboolean SGI_swap_control;
GLboolean EXT_swap_control;
GLboolean MESA_swap_control;
GLboolean ARB_multisample;
GLboolean ARB_create_context;
GLboolean ARB_create_context_profile;