Added more flexibility into the State::checkGLErrors() method, allowing calling code to pass in two strings.

Improved the StateSet::compileGLObjects() usage of checkGLErrors() to make the warning reports more meaningful.
This commit is contained in:
Robert Osfield
2016-11-14 11:59:47 +00:00
parent e6052ef4b4
commit 99cb8ebacf
3 changed files with 13 additions and 13 deletions

View File

@@ -1075,7 +1075,7 @@ unsigned int State::getClientActiveTextureUnit() const
}
bool State::checkGLErrors(const char* str) const
bool State::checkGLErrors(const char* str1, const char* str2) const
{
GLenum errorNo = glGetError();
if (errorNo!=GL_NO_ERROR)
@@ -1091,15 +1091,19 @@ bool State::checkGLErrors(const char* str) const
OSG_NOTIFY(notifyLevel)<<"Warning: detected OpenGL error number 0x" << std::hex << errorNo << std::dec;
}
if (str)
if (str1 || str2)
{
OSG_NOTIFY(notifyLevel)<<" at "<<str<< std::endl;
OSG_NOTIFY(notifyLevel)<<" at";
if (str1) { OSG_NOTIFY(notifyLevel)<<" "<<str1; }
if (str2) { OSG_NOTIFY(notifyLevel)<<" "<<str2; }
}
else
{
OSG_NOTIFY(notifyLevel)<<" in osg::State."<< std::endl;
OSG_NOTIFY(notifyLevel)<<" in osg::State.";
}
OSG_NOTIFY(notifyLevel)<< std::endl;
return true;
}
return false;