X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fgl_video_view.cc;h=a0f83db6d4390dfba4d056d5d4eb13da67048164;hb=0de70cc4c83ebc5e4a8eb620b5d46a2aad2046b7;hp=da5cc31a06124686beb06f3c1ae75be6082f5eab;hpb=4358c54894741eef96bc8018a57fb2b0c059a4c1;p=dcpomatic.git diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc index da5cc31a0..a0f83db6d 100644 --- a/src/wx/gl_video_view.cc +++ b/src/wx/gl_video_view.cc @@ -29,18 +29,29 @@ #ifdef DCPOMATIC_OSX #include #include -#else +#include +#include +#endif + +#ifdef DCPOMATIC_LINUX #include #include #include #endif +#ifdef DCPOMATIC_WINDOWS +#include +#include +#include +#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); @@ -52,21 +63,27 @@ 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 #ifdef DCPOMATIC_OSX /* Enable vsync */ - long swapInterval = 1; + GLint swapInterval = 1; CGLSetParameter (CGLGetCurrentContext(), kCGLCPSwapInterval, &swapInterval); + _vsync_enabled = true; #endif glGenTextures (1, &_id);