Hello, I don't follow completely your meaning but I guess if you have an array with {GL_COLOR_ATTACHMENT0} and call glDrawBuffers(1, arr) (forgive the syntax errors) you will "Dis" the DrawBuffer attribute. That means you will need to have the array of attachments and it's length as Attribute in the state, where the defaults are as I wrote before, and then when the state pops, the difference will be noted and the default will apply.
Hope that helps, Guy. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Art Tevs Sent: Tuesday, April 15, 2008 1:46 PM To: OpenSceneGraph Users Subject: Re: [osg-users] "Dis"applying of StateAttributes Hi Robert, > One can't remove state from OpenGL, its a state > machine, you only modify its > current state. The Yes, I know. > OSG manages this by using > osg::State which maintains a > stack of StateSet that are currently applied, and > stacks for the individual > modes and attributes that are applied. When a > stateset is popped the > modes/attributes that were applied by the parent > StateSet are applied. This means that the parent StateSet has to contain some stateattribute which restores the applied state in the previous state. Ok, I need this behaviour for the following thing: I am currently preparing a patch for the FBOs and MRTs. Here I would like to move the glDrawBuffers call from the RenderStage to the FBO, since I would like to use FBOs without camera's, hence on its own. This would be also more general approach, then this one, which we currently have. Now the problem is, that in FrameBufferObject::apply() method I would like to set the draw buffers accordingly. However, I have no idea how to restore the opengl's state back?!?!?! If there would be something like ::disapply() method, I would be able to restore the drawbuffers by resetting them to the value as they were before. Since there is no such call, I have to set the drawbuffers to some default value, for which there is no real default value exists???? So any ideas how to manage this? > These applies are all done lazily - so if the state > doesn't change then no > OpenGL class are made. > > When non modes or attributes are left on the stack > once everything is popped > off then default modes are used, and default > constructed versions of the > attributes are applied to restore OpenGL state back > to defaults. > > Robert. > > On Tue, Apr 15, 2008 at 12:27 PM, Art Tevs > <[EMAIL PROTECTED]> wrote: > > > Hi Robert, > > > > no the question wasn't how to remove > stateattribute > > from osg, but how to reset/remove state from > opengl. > > > > Imagine following situation: > > > > A > > / \ > > B C > > > > Node B set some attribute. Node C doesn't have > this > > attribute, however since there seems no "dis"apply > > method, C would get this attribute too (of course > > assuming B and C are rendered sequentially). > > > > In the stateset->removeAttribute() there is a call > to > > setAssociatedModes() which probably disables the > > corresponding mode of the attribute. However, what > to > > do if there is no mode associated with the > attribute? > > > > How is this managed? > > > > > > --- Robert Osfield <[EMAIL PROTECTED]> > schrieb: > > > > > Hi Art, > > > > > > If you want to remove a mode or attribute you > simply > > > one of use: > > > > > > stateset->removeMode(..); > > > stateset->removeAttribute(..); > > > stateset->removeTextureAttribute(unit,..); > > > > > > This will make the StateSet inherit from above. > > > > > > As for the default set, OpenGL defaults are > almost > > > always used, but not > > > quite always. The GL_DEPTH_TEST is on by > default in > > > the OSG. Defaults for > > > the attributes can be found in the default > > > constructed versions of those > > > attributes. > > > > > > Robert. > > > > > > On Tue, Apr 15, 2008 at 11:14 AM, Art Tevs > > > <[EMAIL PROTECTED]> wrote: > > > > > > > Hi folks, > > > > > > > > imagine I have a StateAttribute which do set > the > > > > OpenGL's pipeline in some state. Now this > > > attribute is > > > > applied for a node and the corresponding > subgraph > > > or > > > > only that node is rendered with this > attribute. > > > > > > > > However there is no call to disapply this > > > attribute. I > > > > mean how do I know which state the OpenGL's > > > pipeline > > > > was before this attribute was applied to > restore > > > it. > > > > > > > > OK, as far as I see from different > > > StateAttribute's > > > > derivatives (FBO, Viewport, Texture, ...) > there is > > > > some default function call to set the GL's > > > pipeline in > > > > a predictable state (i.e. bind FBO or texture > with > > > id > > > > 0, set default viewport, ...). > > > > > > > > However what if there is no real default state > to > > > > which to return the GL's pipeline? How to > manage > > > this? > > > > > > > > > > > > > > > > > > __________________________________________________________ > > > > Gesendet von Yahoo! Mail. > > > > Der Lieblings-Mailbox der Welt. > > > > http://de.overview.mail.yahoo.com > > > > > _______________________________________________ > > > > osg-users mailing list > > > > osg-users@lists.openscenegraph.org > > > > > > > > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g > > > > > > > > > _______________________________________________ > > > osg-users mailing list > > > osg-users@lists.openscenegraph.org > > > > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g > > > > > > > > > > > > __________________________________________________________ > > Gesendet von Yahoo! Mail. > > Der Lieblings-Mailbox der Welt. > > http://de.overview.mail.yahoo.com > > _______________________________________________ > > osg-users mailing list > > osg-users@lists.openscenegraph.org > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g > > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g > __________________________________________________________ Gesendet von Yahoo! Mail. Der Lieblings-Mailbox der Welt. http://de.overview.mail.yahoo.com _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org