update ooo310-m15
[ooovba.git] / applied_patches / 0559-transogl-vsync.diff
blob18694d8547b229bd9e048751e384201b273c0898
1 --- slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx.oglvsync~ 2008-07-07 20:49:22.348097043 +0200
2 +++ slideshow/source/engine/OGLTrans/OGLTrans_TransitionerImpl.cxx 2008-07-07 20:53:29.174846394 +0200
3 @@ -28,6 +28,7 @@
5 ************************************************************************/
7 +#define GLX_GLXEXT_PROTOTYPES 1
8 #include "OGLTrans_TransitionImpl.hxx"
10 #include <com/sun/star/rendering/IntegerBitmapLayout.hpp>
11 @@ -71,6 +72,7 @@ namespace unx
13 #include <X11/keysym.h>
14 #include <GL/glx.h>
15 +#include <GL/glxext.h>
17 #endif
19 @@ -128,6 +130,9 @@ private:
20 unsigned int bpp;
21 unsigned int Width;
22 unsigned int Height;
23 + const char* GLXExtensions;
25 + bool HasGLXExtension( const char* name ) { return gluCheckExtension( (const GLubyte*) name, (const GLubyte*) GLXExtensions ); };
26 } GLWin;
28 /** OpenGL handle to the leaving slide's texture
29 @@ -295,6 +300,8 @@ void OGLTransitionerImpl::initWindowFrom
30 #elif defined( UNX )
31 GLWin.dpy = reinterpret_cast<unx::Display*>(pChildSysData->pDisplay);
32 GLWin.win = pChildSysData->aWindow;
33 + GLWin.GLXExtensions = unx::glXQueryExtensionsString( GLWin.dpy, GLWin.screen );
34 + OSL_TRACE("available GLX extensions: %s", GLWin.GLXExtensions);
35 #endif
38 @@ -335,6 +342,15 @@ void OGLTransitionerImpl::initWindowFrom
39 wglMakeCurrent(GLWin.hDC,GLWin.hRC);
40 #elif defined( UNX )
41 glXMakeCurrent( GLWin.dpy, GLWin.win, GLWin.ctx );
42 + if(GLWin.HasGLXExtension("GLX_SGI_swap_control")) {
43 + // enable vsync
44 + typedef GLint (*glXSwapIntervalProc)(GLint);
45 + glXSwapIntervalProc glXSwapInterval = (glXSwapIntervalProc) unx::glXGetProcAddress( (const GLubyte*) "glXSwapIntervalSGI" );
46 + if( glXSwapInterval ) {
47 + glXSwapInterval( 1 );
48 + OSL_TRACE("set swap interval to 1 (enable vsync)");
49 + }
50 + }
51 /* TODO: check for version once the bug in fglrx driver is fixed */
52 bBrokenTexturesATI = (strcmp( (const char *) glGetString( GL_VENDOR ), "ATI Technologies Inc." ) == 0 );
53 #endif