diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-04-21 22:01:21 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-04-28 02:31:15 +0200 |
| commit | 7f25fc20f432649759743848667a5e17b3c43c88 (patch) | |
| tree | 15674d53095bc71f640b5b88f95b758a4c08516f | |
| parent | 455b0724cae66b70ae204a6035e376f5dbf2b972 (diff) | |
Move check_gl_error() out to gl_util.{cc,h}.
| -rw-r--r-- | src/wx/gl_util.cc | 45 | ||||
| -rw-r--r-- | src/wx/gl_util.h | 47 | ||||
| -rw-r--r-- | src/wx/gl_video_view.cc | 11 | ||||
| -rw-r--r-- | src/wx/wscript | 1 |
4 files changed, 94 insertions, 10 deletions
diff --git a/src/wx/gl_util.cc b/src/wx/gl_util.cc new file mode 100644 index 000000000..f4f079ffa --- /dev/null +++ b/src/wx/gl_util.cc @@ -0,0 +1,45 @@ +/* + Copyright (C) 2025 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include "gl_util.h" +#include "lib/compose.hpp" +#include "lib/dcpomatic_assert.h" +#include <wx/wx.h> + + +using std::string; + + +/* This will only build on an new-enough wxWidgets: see the comment in gl_video_view.h */ +#if wxCHECK_VERSION(3,1,0) + +void +check_gl_error(char const * last) +{ + GLenum const e = glGetError(); + if (e != GL_NO_ERROR) { + boost::throw_exception(GLError(last, e)); + } +} + + +#endif + diff --git a/src/wx/gl_util.h b/src/wx/gl_util.h new file mode 100644 index 000000000..83dbf06d4 --- /dev/null +++ b/src/wx/gl_util.h @@ -0,0 +1,47 @@ +/* + Copyright (C) 2025 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include <wx/wx.h> + + +/* This will only build on an new-enough wxWidgets: see the comment in gl_video_view.h */ +#if wxCHECK_VERSION(3,1,0) + +#ifdef DCPOMATIC_OSX +#define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED +#include <OpenGL/OpenGL.h> +#include <OpenGL/gl3.h> +#endif + +#ifdef DCPOMATIC_LINUX +#include <GL/glu.h> +#include <GL/glext.h> +#endif + +#ifdef DCPOMATIC_WINDOWS +#include <GL/glu.h> +#include <GL/wglext.h> +#endif + +extern void check_gl_error(char const* last); + +#endif + diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc index 6fc416ade..9d85b4c78 100644 --- a/src/wx/gl_video_view.cc +++ b/src/wx/gl_video_view.cc @@ -29,6 +29,7 @@ #if wxCHECK_VERSION(3,1,0) #include "film_viewer.h" +#include "gl_util.h" #include "wx_util.h" #include "lib/butler.h" #include "lib/cross.h" @@ -66,16 +67,6 @@ using namespace boost::placeholders; #endif -static void -check_gl_error(char const * last) -{ - GLenum const e = glGetError(); - if (e != GL_NO_ERROR) { - boost::throw_exception(GLError(last, e)); - } -} - - GLVideoView::GLVideoView(FilmViewer* viewer, wxWindow *parent) : VideoView(viewer) , _context(nullptr) diff --git a/src/wx/wscript b/src/wx/wscript index e1a2bf084..c9229416c 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -97,6 +97,7 @@ sources = """ gdc_certificate_panel.cc general_preferences_page.cc gl_video_view.cc + gl_util.cc hints_dialog.cc html_dialog.cc image_sequence_dialog.cc |
