diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-08-19 20:14:56 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-08-25 08:44:48 +0200 |
| commit | c1e7425cc3cb55dd0c9ddb15d00b6c2eb2faef0f (patch) | |
| tree | 9b491ab5fd0402187ba189255043ca972d164f5a /src/wx/gl_util.cc | |
| parent | 61c74126cde9592587d31b4acbc54dd6c76a44d3 (diff) | |
Cleanup: extract check_gl_error to gl_util.{cc,h}
Diffstat (limited to 'src/wx/gl_util.cc')
| -rw-r--r-- | src/wx/gl_util.cc | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/wx/gl_util.cc b/src/wx/gl_util.cc new file mode 100644 index 000000000..ea0673db5 --- /dev/null +++ b/src/wx/gl_util.cc @@ -0,0 +1,60 @@ +/* + 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/dcpomatic_assert.h" + +#include <wx/version.h> +/* This will only build on an new-enough wxWidgets: see the comment in gl_util.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 + + +using namespace dcpomatic::gl; + + +void +dcpomatic::gl::check_error(char const * last) +{ + auto const e = glGetError(); + if (e != GL_NO_ERROR) { + throw GLError(last, e); + } +} + + +#endif + |
