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:
parent
e6052ef4b4
commit
99cb8ebacf
@ -870,7 +870,7 @@ class OSG_EXPORT State : public Referenced
|
||||
/** Get whether and how often OpenGL errors should be checked for.*/
|
||||
CheckForGLErrors getCheckForGLErrors() const { return _checkGLErrors; }
|
||||
|
||||
bool checkGLErrors(const char* str) const;
|
||||
bool checkGLErrors(const char* str1=0, const char* str2=0) const;
|
||||
bool checkGLErrors(StateAttribute::GLMode mode) const;
|
||||
bool checkGLErrors(const StateAttribute* attribute) const;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -1443,15 +1443,14 @@ void StateSet::setThreadSafeRefUnref(bool threadSafe)
|
||||
void StateSet::compileGLObjects(State& state) const
|
||||
{
|
||||
bool checkForGLErrors = state.getCheckForGLErrors()==osg::State::ONCE_PER_ATTRIBUTE;
|
||||
if (checkForGLErrors && state.checkGLErrors("before StateSet::compileGLObejcts()"))
|
||||
|
||||
for(AttributeList::const_iterator itr = _attributeList.begin();
|
||||
itr!=_attributeList.end();
|
||||
++itr)
|
||||
{
|
||||
itr->second.first->compileGLObjects(state);
|
||||
if (checkForGLErrors && state.checkGLErrors("StateSet::compileGLObejcts() compiling attribute"))
|
||||
{
|
||||
OSG_NOTICE<<" GL Error when compiling "<<itr->second.first->className()<<std::endl;
|
||||
}
|
||||
if (checkForGLErrors) state.checkGLErrors("StateSet::compileGLObejcts() compiling ", itr->second.first->className());
|
||||
}
|
||||
|
||||
for(TextureAttributeList::const_iterator taitr=_textureAttributeList.begin();
|
||||
@ -1463,10 +1462,7 @@ void StateSet::compileGLObjects(State& state) const
|
||||
++itr)
|
||||
{
|
||||
itr->second.first->compileGLObjects(state);
|
||||
if (checkForGLErrors && state.checkGLErrors("StateSet::compileGLObejcts() compiling texture attribute"))
|
||||
{
|
||||
OSG_NOTICE<<" GL Error when compiling "<<itr->second.first->className()<<std::endl;
|
||||
}
|
||||
if (checkForGLErrors) state.checkGLErrors("StateSet::compileGLObejcts() compiling texture attribute", itr->second.first->className());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user