On 20 August 2013 13:05, Trajce Nikolov NICK
<[email protected]>wrote:

> lol ;-) ... Come on. I am trying to wrap it with osg code instead of
> OpenGL calls (and forgot many things in between the ages)
>

There isn't a straight single line call, or answer to your question about
resetting state.

osg::State has a list of all the current StateSet + Modes in a series of
stacks, a stack for each mode and stack for each stateattribute. Internally
osg::State maintains a global_default_attribute for each of these stacks
and calls this when the stack is newly emptied when the last stateattribute
of that type of popped and the current state applied, the method
osg::State::applyGlobalDefaultAttribute(AtrtributeStack&) does the actual
work so go have a look it it's implementation.  The mode stacks also have a
similar global_default_value member variable that tracks what to apply when
all the modes of given type of popped.

What is missing for you is a convenience method that gets all these
defaults, or applies these. You could write one and submit it for inclusion
in the OSG, or look to create your won StateSet based on these global
defaults embedded in osg::State.

Alternatively just apply the StateSet to make sure the modes and attributes
you care about are set to a value that your OpenGL code requires - this is
normally what one does in this instance.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to