source: git/src/gllogerror.h @ 76cf7f1

RELEASE/1.2debug-cidebug-ci-sanitiserswalls-data
Last change on this file since 76cf7f1 was 0273042, checked in by Olly Betts <olly@…>, 6 years ago

Eliminate use of gluErrorString

Fixes deprecation warning on macOS.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1//
2//  gllogerror.h
3//
4//  Check for and report OpenGL errors
5//
6//  Copyright (C) 2002 Mark R. Shinwell.
7//  Copyright (C) 2003,2004,2005,2006,2007,2011,2012,2014,2017,2018 Olly Betts
8//
9//  This program is free software; you can redistribute it and/or modify
10//  it under the terms of the GNU General Public License as published by
11//  the Free Software Foundation; either version 2 of the License, or
12//  (at your option) any later version.
13//
14//  This program is distributed in the hope that it will be useful,
15//  but WITHOUT ANY WARRANTY; without even the implied warranty of
16//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17//  GNU General Public License for more details.
18//
19//  You should have received a copy of the GNU General Public License
20//  along with this program; if not, write to the Free Software
21//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22//
23
24#include "wx.h"
25
26void log_gl_error(const wxChar * str, GLenum error_code);
27
28// Important: CHECK_GL_ERROR must not be called within a glBegin()/glEnd() pair
29//            (thus it must not be called from BeginLines(), etc., or within a
30//             BeginLines()/EndLines() block etc.)
31#define CHECK_GL_ERROR(M, F) do { \
32    extern bool opengl_initialised; \
33    if (!opengl_initialised) { \
34        wxLogError(wxT(__FILE__ ":" STRING(__LINE__) ": OpenGL not initialised " \
35                       "before (call " F " in method " M ")")); \
36    } \
37    GLenum error_code_ = glGetError(); \
38    if (error_code_ != GL_NO_ERROR) { \
39        log_gl_error(wxT(__FILE__ ":" STRING(__LINE__) ": OpenGL error: %s " \
40                         "(call " F " in method " M ")"), error_code_); \
41    } \
42} while (0)
43
Note: See TracBrowser for help on using the repository browser.