Robert,

Thanks for the quick answers.

[..]
> Do you approve such a plan of extending CullSettings masks for use with
> DrawBuffer and ReadBuffer ?

I think this would be appropriate - i.e. to extend CullSettings to
default to inheriting the _readBuffer and _drawBuffer values, and on
setting change this inheritance mask to allow the variable to be used.
 Other members of CullSettings work this way so look at these for a
template.

Thats what I plan to do. I picked up Camera::_clearColor handling example for the same purpose.

[..]
>
> Which option do You prefer here ?

I don't prefer either....

I wonder if a has been applied flags could be used in osg::State to
accompany the _drawBuffer and _readBuffer member variables, and if the
variables haven't yet been applied to OpenGL the previous value is
ignored and the gl calls are made regardless of whether previous value
held in osg::State. This way the default effectively doesn't existing
and the calling code will always set it.

I agree, it seems the best option. Using existing framework like haveAppliedAttribute would mean that we want to make DrawBuffer/ReadBuffer an attribute. I am not sure if this is what you are after ? To some degree it makes sense, I can imagine that someone may want to add such state in StateSet to turn off DrawBuffer to draw to depthBuffer only.

But on the other hand I have the feeling that image/texture read may be vulnerable to unexpected readBuffer changes. So maybe it wil be better to not make DrawBuffer/ReadBuffer attributes but treat them independently like I propesed earlier + add extra flags bool: _drawBufferValid, _readBufferValid and corresponding logic and methods to make sure that first setDrawBuffer/setReadBuffer is always apllied.

This is an example how osg::State::setDrawBuffer method would look in this scenario:

void osg::State::setDrawBuffer( GLenum  bufferMode )
{
   if( !_drawBufferValid || _drawBuffer != bufferMode )
   {
       glDrawBuffer( bufferMode )
       _drawBuffer = bufferMode;
       _drawBufferValid = true;
   }
}

If you accept that, I am rolling up my sleeves and start work ;-)

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

Reply via email to