2

I have a problem with multiple "Warning: detected OpenGL error 'invalid value' after RenderBin::draw(...)" error messages emitted by OSG. I found this thread showing a way to add additional debug information. Unfortunately I can't find a way to set the State.

I can create a State and set the flag using the code:

osg::ref_ptr<osg::State> debugState = new osg::State();  
debugState->setCheckForGLErrors(osg::State::CheckForGLErrors::ONCE_PER_ATTRIBUTE);

But what do I do after? I can't find a way to add the State to a StateSet.

  • can you please help me to install OpensceneGraph on Ubuntu.. i am struggling to install it, don't know where to start and where it should end – Irfan Ghaffar7 Mar 02 '15 at 14:34

1 Answers1

2

You can obviously use gDEBugger as some of the answers in the thread suggest. If you still want to really do it via osg::State then you can probably add a osg::Drawable::DrawCallback to all your drawables. Then within the drawImplementation of the DrawCallback you can do something like -

virtual void drawImplementation (osg::RenderInfo & renderinfo, const osg::Drawable * drawable) const 
{
  State& state = *renderInfo.getState();
  state->setCheckForGLErrors(osg::State::CheckForGLErrors::ONCE_PER_ATTRIBUTE);
  drawable->drawImplementation(); 
}

I am not very sure if changing the state this late would work perfectly, you need to check this. If it doesn't work you can also do something like state.checkGLErrors("start of Geometry::drawImplementation()"); and state.checkGLErrors("end of Geometry::drawImplementation()"); before and after calling drawable->drawImplementation() .

sn710
  • 581
  • 5
  • 20