[osg-users] Force OSG for GLES 2.0 to reenable vertex attributes before drawing geometry
Robert Osfield
robert.osfield at gmail.com
Mon Jun 24 06:08:21 PDT 2019
Hi Plamen,
It sounds like Qt's bad habit of changing OpenGL state for it's own
purposes and not resetting that afterwards is the cause your problems.
Unless you specifcally need Qt to create your graphics widow and UI I would
recommend not using it, the built in windowing support that the OSG
provides will be better suited for the purpose.
If you have to use Qt then you'll need to tell the OSG what state can't be
trusted and needs to be reapplied. I would suggest putting the state dirty
calls into the code prior to calling the OSG's frame, Where best to place
this will depend upon how you've integrate the OSG. Your own workaround
will be doing a form of dirty and probably why it works. There are other
methods for dirtying state in osg::State, just search for dirty in the
State header.
Robert.
On Mon, 24 Jun 2019 at 11:39, Plamen Terziev <plspace at abv.bg> wrote:
> 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
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20190624/bcf5fd95/attachment.html>
More information about the osg-users
mailing list