Added support for GLX_EXT_swap_control.

This commit is contained in:
Camilla Berglund 2010-11-15 21:17:42 +01:00
parent 10a2b3fa79
commit 1ee78ecef5
3 changed files with 27 additions and 6 deletions

View File

@ -295,6 +295,7 @@ version of GLFW.</p>
<li>Removed <code>GLFWCALL</code> and <code>GLFWAPIENTRY</code> macros for stdcall calling convention</li>
<li>Bugfix: The default OpenGL version in the <code>version</code> test was set to 1.1</li>
<li>Bugfix: The OpenGL profile and forward-compatibility window parameters were not saved after context creation</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] Bugfix: Calling <code>glXCreateContextAttribsARB</code> with an unavailable OpenGL version caused the application to terminate with a <code>BadMatch</code> Xlib error</li>
<li>[Win32] Removed explicit support for versions of Windows older than Windows XP</li>
<li>[Win32] Bugfix: Window activation and iconification did not work as expected</li>

View File

@ -100,6 +100,7 @@ typedef struct _GLFWcontextGLX
// GLX extensions
PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI;
PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT;
PFNGLXGETFBCONFIGATTRIBSGIXPROC GetFBConfigAttribSGIX;
PFNGLXCHOOSEFBCONFIGSGIXPROC ChooseFBConfigSGIX;
PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC CreateContextWithConfigSGIX;
@ -107,6 +108,7 @@ typedef struct _GLFWcontextGLX
PFNGLXCREATECONTEXTATTRIBSARBPROC CreateContextAttribsARB;
GLboolean has_GLX_SGIX_fbconfig;
GLboolean has_GLX_SGI_swap_control;
GLboolean has_GLX_EXT_swap_control;
GLboolean has_GLX_ARB_multisample;
GLboolean has_GLX_ARB_create_context;
GLboolean has_GLX_ARB_create_context_profile;

View File

@ -667,13 +667,25 @@ static int createContext(_GLFWwindow* window,
static void initGLXExtensions(_GLFWwindow* window)
{
if (_glfwPlatformExtensionSupported("GLX_SGI_swap_control"))
if (_glfwPlatformExtensionSupported("GLX_EXT_swap_control"))
{
window->GLX.SwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)
_glfwPlatformGetProcAddress("glXSwapIntervalSGI");
window->GLX.SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)
_glfwPlatformGetProcAddress("glXSwapIntervalEXT");
if (window->GLX.SwapIntervalSGI)
window->GLX.has_GLX_SGI_swap_control = GL_TRUE;
if (window->GLX.SwapIntervalEXT)
window->GLX.has_GLX_EXT_swap_control = GL_TRUE;
}
if (!window->GLX.has_GLX_EXT_swap_control)
{
if (_glfwPlatformExtensionSupported("GLX_SGI_swap_control"))
{
window->GLX.SwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)
_glfwPlatformGetProcAddress("glXSwapIntervalSGI");
if (window->GLX.SwapIntervalSGI)
window->GLX.has_GLX_SGI_swap_control = GL_TRUE;
}
}
if (_glfwPlatformExtensionSupported("GLX_SGIX_fbconfig"))
@ -1684,7 +1696,13 @@ void _glfwPlatformSwapInterval(int interval)
{
_GLFWwindow* window = _glfwLibrary.currentWindow;
if (window->GLX.has_GLX_SGI_swap_control)
if (window->GLX.has_GLX_EXT_swap_control)
{
window->GLX.SwapIntervalEXT(_glfwLibrary.X11.display,
window->X11.handle,
interval);
}
else if (window->GLX.has_GLX_SGI_swap_control)
window->GLX.SwapIntervalSGI(interval);
}