Moved getenv usage across to safer osg::getEnvVar() usage

This commit is contained in:
Robert Osfield
2017-11-01 17:38:33 +00:00
parent 0e7e06349e
commit 338b0e2b7b
6 changed files with 39 additions and 24 deletions

View File

@@ -18,6 +18,7 @@
#include <osg/Drawable>
#include <osg/ApplicationUsage>
#include <osg/ContextData>
#include <osg/EnvVar>
#include <sstream>
#include <algorithm>
@@ -75,14 +76,17 @@ State::State():
_checkGLErrors = ONCE_PER_FRAME;
const char* str = getenv("OSG_GL_ERROR_CHECKING");
if (str && (strcmp(str,"ONCE_PER_ATTRIBUTE")==0 || strcmp(str,"ON")==0 || strcmp(str,"on")==0))
std::string str;
if (getEnvVar("OSG_GL_ERROR_CHECKING", str))
{
_checkGLErrors = ONCE_PER_ATTRIBUTE;
}
else if(str && (strcmp(str, "OFF") == 0 || strcmp(str, "off") == 0))
{
_checkGLErrors = NEVER_CHECK_GL_ERRORS;
if (str=="ONCE_PER_ATTRIBUTE" || str=="ON" || str=="on")
{
_checkGLErrors = ONCE_PER_ATTRIBUTE;
}
else if (str=="OFF" || str=="off")
{
_checkGLErrors = NEVER_CHECK_GL_ERRORS;
}
}
_currentActiveTextureUnit=0;