From aec2da83cd3276b19d1cc2675c2f0080c5097945 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 29 Feb 2016 06:34:16 +0000 Subject: [PATCH] Add BuildGLErrorCheck(), useful for debugging GL. git-svn-id: https://svn.eduke32.com/eduke32@5641 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/glbuild.h | 6 ++++++ polymer/eduke32/build/src/glbuild.c | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/polymer/eduke32/build/include/glbuild.h b/polymer/eduke32/build/include/glbuild.h index 4cd5f180d..7312bb98d 100644 --- a/polymer/eduke32/build/include/glbuild.h +++ b/polymer/eduke32/build/include/glbuild.h @@ -90,6 +90,12 @@ typedef unsigned int GLenum; #define GL_TEXTURE_RECTANGLE 0x84F5 +// custom error checking + +extern GLenum BuildGLError; +extern void BuildGLErrorCheck(void); + + //////// dynamic/static API wrapping //////// #if defined DYNAMIC_GL diff --git a/polymer/eduke32/build/src/glbuild.c b/polymer/eduke32/build/src/glbuild.c index 3b9a8fbf7..78be2d6ab 100644 --- a/polymer/eduke32/build/src/glbuild.c +++ b/polymer/eduke32/build/src/glbuild.c @@ -11,6 +11,15 @@ # include "sdlayer.h" #endif +GLenum BuildGLError; +void BuildGLErrorCheck(void) +{ + volatile GLenum err; + while ((err = bglGetError()) != GL_NO_ERROR) + { + BuildGLError = err; // set a watchpoint/breakpoint here + } +} #if defined DYNAMIC_GL