From f09d583f4486537dc18605e0666932ec10620827 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 18 Apr 2008 11:09:54 +0000 Subject: [PATCH] Introduce OSG_GL_ERROR_CHECKING env var checking to osg::State constructor so that you can enable fine grained check via env vars o.e. export OSG_GL_ERROR_CHECKING=ONCE_PER_ATTRIBUTE --- src/osg/State.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/osg/State.cpp b/src/osg/State.cpp index fb6aab39b..6a74a30d0 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #ifndef GL_MAX_TEXTURE_COORDS #define GL_MAX_TEXTURE_COORDS 0x8871 @@ -30,6 +31,8 @@ using namespace std; using namespace osg; +static ApplicationUsageProxy State_e0(ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_GL_ERROR_CHECKING ","ONCE_PER_ATTRIBUTE | ON | on enables fine grained checking, ONCE_PER_FRAME enables coarse grained checking"); + State::State(): Referenced(true) { @@ -42,11 +45,13 @@ State::State(): _abortRenderingPtr = false; -#if 1 _checkGLErrors = ONCE_PER_FRAME; -#else - _checkGLErrors = ONCE_PER_ATTRIBUTE; -#endif + + const char* str = getenv("OSG_GL_ERROR_CHECKING"); + if (str && (strcmp(str,"ONCE_PER_ATTRIBUTE")==0 || strcmp(str,"ON")==0 || strcmp(str,"on")==0)) + { + _checkGLErrors = ONCE_PER_ATTRIBUTE; + } _currentActiveTextureUnit=0; _currentClientActiveTextureUnit=0;