Fix typo causing failures to update the preview after changing
[dcpomatic.git] / src / wx / gl_video_view.cc
index 52d39b571d435e8f4e2d7d89ef741649f214edc7..a0f83db6d4390dfba4d056d5d4eb13da67048164 100644 (file)
 #include <OpenGL/glext.h>
 #include <OpenGL/CGLTypes.h>
 #include <OpenGL/OpenGL.h>
-#else
+#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);
@@ -54,13 +63,18 @@ GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent)
                /* Enable vsync */
                Display* dpy = wxGetX11Display();
                glXSwapIntervalEXT (dpy, DefaultScreen(dpy), 1);
+               _vsync_enabled = true;
        }
 #endif
 
 #ifdef DCPOMATIC_WINDOWS
        if (_canvas->IsExtensionSupported("WGL_EXT_swap_control")) {
                /* Enable vsync */
-               wglSwapIntervalEXT (1);
+               PFNWGLSWAPINTERVALEXTPROC swap = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress("wglSwapIntervalEXT");
+               if (swap) {
+                       swap (1);
+                       _vsync_enabled = true;
+               }
        }
 
 #endif
@@ -69,6 +83,7 @@ GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent)
        /* Enable vsync */
        GLint swapInterval = 1;
        CGLSetParameter (CGLGetCurrentContext(), kCGLCPSwapInterval, &swapInterval);
+       _vsync_enabled = true;
 #endif
 
        glGenTextures (1, &_id);