[osg-users] Force OSG for GLES 2.0 to reenable vertex attributes before drawing geometry

Plamen Terziev plspace at abv.bg
Mon Jun 24 03:39:28 PDT 2019


Hi Robert,

Sorry for the late reply and thank your for your answer.

I've checked the OSG source and I saw that OSG manages the OpenGL state itself and that's why if someone (in my case Qt) changes the state then OSG does not know that the state has changed. 

This seems to not be a bug in OSG at all. 

What I am doing is to call at the end of each frame the following:


Code:

auto state = m_osg->getCamera()->getGraphicsContext()->getState();
state->lazyDisablingOfVertexAttributes();
state->applyDisablingOfVertexAttributes();




So the next frame OSG enables and binds the vertex attributes which fixes the issue.

I am not sure my code for invalidating the state is correct. Is there any better way to do this?

My end goal is to tell OSG that what the OpenGL state is different and to invalidate its state.

Also I've added Mapbox as a OSG drawable node and after Mapbox node renders then the next nodes do not render anymore. Seems that Mapbox is also changing some OpenGL state and OSG is not aware of this.

Is there a way to tell OSG to invalidate the state between 2 nodes rendering? I am aware for the performance hit here by calling extra gl calls but this will fix my issues.

Also is it possible to opt out the entire OSG state management so each frame to really make the OpenGL calls?

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76322#76322







More information about the osg-users mailing list