#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);
/* 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);