From 99cb8ebacf2485ccb704c66865ab09a2e7190256 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 14 Nov 2016 11:59:47 +0000 Subject: [PATCH] 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. --- include/osg/State | 2 +- src/osg/State.cpp | 12 ++++++++---- src/osg/StateSet.cpp | 12 ++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/osg/State b/include/osg/State index f1af1e241..4560bccf6 100644 --- a/include/osg/State +++ b/include/osg/State @@ -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; diff --git a/src/osg/State.cpp b/src/osg/State.cpp index fef7a471e..0cd80d670 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -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 "<second.first->compileGLObjects(state); - if (checkForGLErrors && state.checkGLErrors("StateSet::compileGLObejcts() compiling attribute")) - { - OSG_NOTICE<<" GL Error when compiling "<second.first->className()<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 "<second.first->className()<second.first->className()); } } }