From c25fcddc699073cab53183ce5c638eca96d820e8 Mon Sep 17 00:00:00 2001 From: cxgeorge <> Date: Wed, 18 Jul 2001 04:50:25 +0000 Subject: [PATCH] make report_errors available to wgldisplay --- panda/src/glgsg/glGraphicsStateGuardian.I | 9 ++++++--- panda/src/glgsg/glGraphicsStateGuardian.cxx | 18 +++++++++++------- panda/src/glgsg/glGraphicsStateGuardian.h | 3 --- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/panda/src/glgsg/glGraphicsStateGuardian.I b/panda/src/glgsg/glGraphicsStateGuardian.I index 6049209ee4..392d508576 100644 --- a/panda/src/glgsg/glGraphicsStateGuardian.I +++ b/panda/src/glgsg/glGraphicsStateGuardian.I @@ -1203,14 +1203,17 @@ issue_scene_graph_color() { //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::report_errors -// Access: Protected +// Access: Public // Description: Checks for any outstanding error codes and outputs // them, if found. If NDEBUG is defined, this function // does nothing. //////////////////////////////////////////////////////////////////// -INLINE void GLGraphicsStateGuardian:: -report_errors() const { +INLINE void +report_errors() { + // pulling this out of gsg since I'd like to call it when there's no gsg ptr around #ifndef NDEBUG + extern void report_errors_loop(GLenum error_code); + GLenum error_code = glGetError(); if (error_code != GL_NO_ERROR) { report_errors_loop(error_code); diff --git a/panda/src/glgsg/glGraphicsStateGuardian.cxx b/panda/src/glgsg/glGraphicsStateGuardian.cxx index 63a782d5a7..5b2e933a06 100644 --- a/panda/src/glgsg/glGraphicsStateGuardian.cxx +++ b/panda/src/glgsg/glGraphicsStateGuardian.cxx @@ -1768,7 +1768,9 @@ release_texture(TextureContext *tc) { GLTextureContext *gtc = DCAST(GLTextureContext, tc); Texture *tex = tc->_texture; - glDeleteTextures(1, >c->_index); + HGLRC curcxt=wglGetCurrentContext(); + if(curcxt!=NULL) + glDeleteTextures(1, >c->_index); gtc->_index = 0; bool erased = unmark_prepared_texture(gtc); @@ -3536,19 +3538,21 @@ compute_distance_to(const LPoint3f &point) const { } //////////////////////////////////////////////////////////////////// -// Function: GLGraphicsStateGuardian::report_errors_loop +// Function: report_errors_loop // Access: Protected // Description: The internal implementation of report_errors(). // Don't call this function; use report_errors() // instead. //////////////////////////////////////////////////////////////////// -void GLGraphicsStateGuardian:: -report_errors_loop(GLenum error_code) const { + +void report_errors_loop(GLenum error_code) { #ifndef NDEBUG - while (error_code != GL_NO_ERROR) { - glgsg_cat.error() - << gluErrorString(error_code) << "\n"; +#define MAXGLERRORSREPORTED 20 + int cnt=0; + while ((cnt