Try to enable vsync with GL on Linux.
authorCarl Hetherington <cth@carlh.net>
Mon, 3 Jun 2019 00:28:57 +0000 (01:28 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 3 Jun 2019 00:28:57 +0000 (01:28 +0100)
src/wx/gl_video_view.cc
src/wx/wscript

index 39532ab79b90990900b4c619b9b0daf55ab3e6ee..90a4dfd5c48b667ab5b516cd7d87516cafb75ab7 100644 (file)
@@ -32,6 +32,7 @@
 #else
 #include <GL/glu.h>
 #include <GL/glext.h>
+#include <GL/glxext.h>
 #endif
 
 using std::cout;
@@ -46,6 +47,12 @@ GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent)
        _canvas->Bind (wxEVT_PAINT, boost::bind(&GLVideoView::paint, this));
        _canvas->Bind (wxEVT_SIZE, boost::bind(boost::ref(Sized)));
 
+       if (_canvas->IsExtensionSupported("GLX_EXT_swap_control")) {
+               /* Enable vsync */
+               Display* dpy = wxGetX11Display();
+               glXSwapIntervalEXT (dpy, DefaultScreen(dpy), 1);
+       }
+
        glGenTextures (1, &_id);
        glBindTexture (GL_TEXTURE_2D, _id);
        glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
index 8430b58441708ceae68dbc4c249dfb5d7901ad5c..89a02a3c69c97efdc8b34257d61ec76745a5069d 100644 (file)
@@ -180,6 +180,9 @@ def configure(conf):
                            uselib_store='WXWIDGETS',
                            mandatory=True)
 
+    if conf.env.TARGET_LINUX:
+        conf.env.append_value('CXXFLAGS', ['-DGLX_GLXEXT_PROTOTYPES'])
+
     if conf.options.static_wxwidgets:
        # wx-config returns its static libraries as full paths, without -l prefixes, which confuses
         # check_cfg().  It puts the static libraries into LINKFLAGS_WXWIDGETS, so fish them out.