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;