Fix some build failures due to GL stuff.
authorCarl Hetherington <cth@carlh.net>
Mon, 3 Jun 2019 09:49:49 +0000 (10:49 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 3 Jun 2019 09:49:49 +0000 (10:49 +0100)
src/wx/gl_video_view.cc
src/wx/gl_video_view.h
src/wx/system_information_dialog.cc
src/wx/wscript

index 90a4dfd5c48b667ab5b516cd7d87516cafb75ab7..e1a8523cf4350167ba9fca72aabef37e06f47074 100644 (file)
@@ -47,11 +47,26 @@ GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent)
        _canvas->Bind (wxEVT_PAINT, boost::bind(&GLVideoView::paint, this));
        _canvas->Bind (wxEVT_SIZE, boost::bind(boost::ref(Sized)));
 
+#ifdef DCPOMATIC_LINUX
        if (_canvas->IsExtensionSupported("GLX_EXT_swap_control")) {
                /* Enable vsync */
                Display* dpy = wxGetX11Display();
                glXSwapIntervalEXT (dpy, DefaultScreen(dpy), 1);
        }
+#endif
+
+#ifdef DCPOMATIC_WINDOWS
+       if (_canvas->IsExtensionSupported("WGL_EXT_swap_control")) {
+               /* Enable vsync */
+               wglSwapIntervalEXT (1);
+       }
+
+#endif
+
+#ifdef DCPOMATIC_OSX
+       /* Enable vsync */
+       NSOpenGLCPSwapInterval = 1;
+#endif
 
        glGenTextures (1, &_id);
        glBindTexture (GL_TEXTURE_2D, _id);
index 42a3f89ba8236ae6b88407c876fd9b53a094d310..c10f32335ec627433c12d50195354095dca6722f 100644 (file)
@@ -23,7 +23,6 @@
 #include <wx/glcanvas.h>
 #include <dcp/util.h>
 #include <boost/shared_ptr.hpp>
-
 #undef None
 #undef Success
 
index 2630833656a0ee128de2a84f4a90d636a6ee9fee..894239b65d39c2951da638ab79aa81e5232b0a8a 100644 (file)
@@ -42,5 +42,11 @@ SystemInformationDialog::SystemInformationDialog (wxWindow* parent)
                add (_("unknown (OpenGL not enabled in DCP-o-matic)"), false);
        }
 
+       add (_("vsync"), true);
+#if !defined(DCPOMATIC_LINUX) || defined(DCPOMATIC_HAVE_GLX_SWAP_INTERVAL_EXT)
+       add (_("enabled"), false);
+#else
+        add (_("disabled"), false);
+#endif
        layout ();
 }
index 89a02a3c69c97efdc8b34257d61ec76745a5069d..f355189ef36b4ec680cf59eb591704bb828f1e77 100644 (file)
@@ -257,6 +257,21 @@ def configure(conf):
         conf.env.STLIB_GL = 'gl'
         conf.env.STLIB_GLU = 'glu'
 
+    if conf.env.TARGET_LINUX:
+        conf.check_cxx(fragment="""
+                                #include <wx/glcanvas.h>
+                                #include <GL/glu.h>
+                                #include <GL/glext.h>
+                                #include <GL/glxext.h>
+                                int main() {
+                                    glXSwapIntervalEXT (0, 0, 1);
+                                    return 0;
+                                }
+                                """,
+                       msg='Checking for glXSwapIntervalEXT',
+                       okmsg='yes',
+                       uselib='GL WXWIDGETS',
+                       define_name='DCPOMATIC_HAVE_GLX_SWAP_INTERVAL_EXT')
 
 
 def build(bld):