From Brad Colbert, Added checking for a NULL return string rom gluErrorString (with slight reformating of this by Robert Osfield.)
This commit is contained in:
@@ -826,9 +826,13 @@ bool State::checkGLErrors(const char* str) const
|
||||
GLenum errorNo = glGetError();
|
||||
if (errorNo!=GL_NO_ERROR)
|
||||
{
|
||||
osg::notify(WARN)<<"Warning: detected OpenGL error '"<<gluErrorString(errorNo);
|
||||
const char* error = (char*)gluErrorString(errorNo);
|
||||
if (error) osg::notify(WARN)<<"Warning: detected OpenGL error '" << error;
|
||||
else osg::notify(WARN)<<"Warning: detected OpenGL error '" << errorNo;
|
||||
|
||||
if (str) osg::notify(WARN)<<"' at "<<str<< std::endl;
|
||||
else osg::notify(WARN)<<"' in osg::State."<< std::endl;
|
||||
else osg::notify(WARN)<<"' in osg::State."<< std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -839,7 +843,10 @@ bool State::checkGLErrors(StateAttribute::GLMode mode) const
|
||||
GLenum errorNo = glGetError();
|
||||
if (errorNo!=GL_NO_ERROR)
|
||||
{
|
||||
osg::notify(WARN)<<"Warning: detected OpenGL error '"<<gluErrorString(errorNo)<<"' after applying GLMode 0x"<<hex<<mode<<dec<< std::endl;
|
||||
const char* error = (char*)gluErrorString(errorNo);
|
||||
if (error) osg::notify(WARN)<<"Warning: detected OpenGL error '"<< error <<"' after applying GLMode 0x"<<hex<<mode<<dec<< std::endl;
|
||||
else osg::notify(WARN)<<"Warning: detected OpenGL error '"<< errorNo <<"' after applying GLMode 0x"<<hex<<mode<<dec<< std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -850,10 +857,13 @@ bool State::checkGLErrors(const StateAttribute* attribute) const
|
||||
GLenum errorNo = glGetError();
|
||||
if (errorNo!=GL_NO_ERROR)
|
||||
{
|
||||
osg::notify(WARN)<<"Warning: detected OpenGL error '"<<gluErrorString(errorNo)<<"' after applying attribute "<<attribute->className()<<" "<<attribute<< std::endl;
|
||||
//attribute->apply(*this);
|
||||
const char* error = (char*)gluErrorString(errorNo);
|
||||
if (error) osg::notify(WARN)<<"Warning: detected OpenGL error '"<< error <<"' after applying attribute "<<attribute->className()<<" "<<attribute<< std::endl;
|
||||
else osg::notify(WARN)<<"Warning: detected OpenGL error '"<< errorNo <<"' after applying attribute "<<attribute->className()<<" "<<attribute<< std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user