From 5495f1b4a9898526da6786b8161bb398d5cfe5bd Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 3 Jun 2019 01:28:57 +0100 Subject: [PATCH] Try to enable vsync with GL on Linux. --- src/wx/gl_video_view.cc | 7 +++++++ src/wx/wscript | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc index 39532ab79..90a4dfd5c 100644 --- a/src/wx/gl_video_view.cc +++ b/src/wx/gl_video_view.cc @@ -32,6 +32,7 @@ #else #include #include +#include #endif using std::cout; @@ -46,6 +47,12 @@ GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent) _canvas->Bind (wxEVT_PAINT, boost::bind(&GLVideoView::paint, this)); _canvas->Bind (wxEVT_SIZE, boost::bind(boost::ref(Sized))); + if (_canvas->IsExtensionSupported("GLX_EXT_swap_control")) { + /* Enable vsync */ + Display* dpy = wxGetX11Display(); + glXSwapIntervalEXT (dpy, DefaultScreen(dpy), 1); + } + glGenTextures (1, &_id); glBindTexture (GL_TEXTURE_2D, _id); glPixelStorei (GL_UNPACK_ALIGNMENT, 1); diff --git a/src/wx/wscript b/src/wx/wscript index 8430b5844..89a02a3c6 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -180,6 +180,9 @@ def configure(conf): uselib_store='WXWIDGETS', mandatory=True) + if conf.env.TARGET_LINUX: + conf.env.append_value('CXXFLAGS', ['-DGLX_GLXEXT_PROTOTYPES']) + if conf.options.static_wxwidgets: # wx-config returns its static libraries as full paths, without -l prefixes, which confuses # check_cfg(). It puts the static libraries into LINKFLAGS_WXWIDGETS, so fish them out. -- 2.30.2