Permalink
Browse files

Implement EQ_WINDOW_IATTR_HINT_SWAPSYNC for GLX

[ ] May break build
[ ] May break existing applications (see CHANGES.txt)
[ ] Bugfix
[x] New Feature
[ ] Cleanup
[ ] Optimization
[ ] Documentation
  • Loading branch information...
1 parent 96cf4fe commit d4775a1a7ee21e406414d1ba3489cd622e9934c5 @eile eile committed May 24, 2011
Showing with 21 additions and 1 deletion.
  1. +17 −0 libs/client/glXWindow.cpp
  2. +3 −0 libs/client/glXWindow.h
  3. +1 −1 libs/client/wglWindow.cpp
View
@@ -94,6 +94,8 @@ bool GLXWindow::configInit()
makeCurrent();
initGLEW();
+ if( getIAttribute( Window::IATTR_HINT_SWAPSYNC ) != AUTO )
+ _initSwapSync();
if( getIAttribute( Window::IATTR_HINT_DRAWABLE ) == FBO )
configInitFBO();
@@ -627,6 +629,21 @@ void GLXWindow::setGLXContext( GLXContext context )
_glXContext = context;
}
+void GLXWindow::_initSwapSync()
+{
+ if( GLXEW_SGI_swap_control )
+ {
+ // set vsync on/off
+ const GLint vsync =
+ ( getIAttribute( Window::IATTR_HINT_SWAPSYNC )==OFF ) ? 0 : 1;
+ glXSwapIntervalSGI( vsync );
+ }
+ else
+ EQWARN << "GLX_SGI_swap_control not supported, ignoring window "
+ << "swapsync hint" << std::endl;
+}
+
+
void GLXWindow::configExit( )
{
if( !_xDisplay )
View
@@ -218,6 +218,9 @@ namespace eq
/** Create an unmapped X11 window. */
XID _createGLXWindow( GLXFBConfig* fbConfig, const PixelViewport& pvp );
+
+ /** Init sync-to-vertical-retrace setting. */
+ void _initSwapSync();
};
}
@@ -467,7 +467,7 @@ void WGLWindow::_initSwapSync()
wglSwapIntervalEXT( vsync );
}
else
- EQWARN << "WGLEW_EXT_swap_control not supported, ignoring window "
+ EQWARN << "WGL_EXT_swap_control not supported, ignoring window "
<< "swapsync hint" << std::endl;
}

0 comments on commit d4775a1

Please sign in to comment.