More accurate reporting of whether vsync is enabled.
[dcpomatic.git] / src / wx / gl_video_view.cc
index 7d72c53b5f46c8135c5904e3f5eddc27844b892b..0e8e459d87b66cc0695f60ae85ef07c98226c0ea 100644 (file)
 #include <OpenGL/glu.h>
 #include <OpenGL/glext.h>
 #include <OpenGL/CGLTypes.h>
-#else
+#include <OpenGL/OpenGL.h>
+#endif
+
+#ifdef DCPOMATIC_LINUX
 #include <GL/glu.h>
 #include <GL/glext.h>
 #include <GL/glxext.h>
 #endif
 
+#ifdef DCPOMATIC_WINDOWS
+#include <GL/glu.h>
+#include <GL/glext.h>
+#include <GL/wglext.h>
+#endif
+
 using std::cout;
 using boost::shared_ptr;
 using boost::optional;
 
 GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent)
        : VideoView (viewer)
+       , _vsync_enabled (false)
 {
        _canvas = new wxGLCanvas (parent, wxID_ANY, 0, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE);
        _context = new wxGLContext (_canvas);
@@ -53,6 +63,7 @@ GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent)
                /* Enable vsync */
                Display* dpy = wxGetX11Display();
                glXSwapIntervalEXT (dpy, DefaultScreen(dpy), 1);
+               _vsync_enabled = true;
        }
 #endif
 
@@ -60,14 +71,16 @@ GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent)
        if (_canvas->IsExtensionSupported("WGL_EXT_swap_control")) {
                /* Enable vsync */
                wglSwapIntervalEXT (1);
+               _vsync_enabled = true;
        }
 
 #endif
 
 #ifdef DCPOMATIC_OSX
        /* Enable vsync */
-       long swapInterval = 1;
+       GLint swapInterval = 1;
        CGLSetParameter (CGLGetCurrentContext(), kCGLCPSwapInterval, &swapInterval);
+       _vsync_enabled = true;
 #endif
 
        glGenTextures (1, &_id);