Added fine grained checking for GL errors in the GLObjectVisitor so that the OSG's default pre compile stage provides better feesback on any GL errors.

This commit is contained in:
Robert Osfield
2017-12-06 09:50:42 +00:00
parent d82a7e7c0b
commit d313184cd0
2 changed files with 36 additions and 11 deletions

View File

@@ -91,6 +91,12 @@ class OSGUTIL_EXPORT GLObjectsVisitor : public osg::NodeVisitor
return _renderInfo;
}
/** Set whether and how often OpenGL errors should be checked for, defaults to osg::State::ONCE_PER_ATTRIBUTE. */
void setCheckForGLErrors(osg::State::CheckForGLErrors check) { _checkGLErrors = check; }
/** Get whether and how often OpenGL errors should be checked for.*/
osg::State::CheckForGLErrors getCheckForGLErrors() const { return _checkGLErrors; }
/** Simply traverse using standard NodeVisitor traverse method.*/
virtual void apply(osg::Node& node);
@@ -105,11 +111,13 @@ class OSGUTIL_EXPORT GLObjectsVisitor : public osg::NodeVisitor
typedef std::set<osg::Drawable*> DrawableAppliedSet;
typedef std::set<osg::StateSet*> StatesSetAppliedSet;
Mode _mode;
osg::RenderInfo _renderInfo;
DrawableAppliedSet _drawablesAppliedSet;
StatesSetAppliedSet _stateSetAppliedSet;
osg::ref_ptr<osg::Program> _lastCompiledProgram;
Mode _mode;
osg::RenderInfo _renderInfo;
osg::State::CheckForGLErrors _checkGLErrors;
DrawableAppliedSet _drawablesAppliedSet;
StatesSetAppliedSet _stateSetAppliedSet;
osg::ref_ptr<osg::Program> _lastCompiledProgram;
};