Hi Rui,

Sorry for the slow review.  Just done a review and feel that how best to
implement this feature is something we need to discuss further.

The issue with the proposed implementation is that state will leak from the
osg::BlendFunc that you set the DrawBufferState on and will affect any MRT
usage out with the subgraph that you apply it to.  Normally with OSG state
the default constructed version of a StateAttribute is applied once all the
version of that state have been popped off the osg::State stack for that
attribute.  This won't be possible with these modifications of
osg::BlendFunc, and the design won't really expand easily to handle this
case.

My own inclination is that this feature is more closely aligned with the
set up of a MRT osg::Camera and it's subgraph, the MRT Camera knows exactly
how many buffers it managing, and at setup the user propbably knows whether
blending is required, so perhaps the osg::Camera::Attachment should be
extended to handle this case.

Another alternative would be to have a separate StateAttribute for this new
control rather than place it with osg::BlendFunc.  This would still have
the issue of how do we manage return the state to appropriate defaults.

Thoughts?
Robert.



On 9 August 2014 17:51, Wang Rui <[email protected]> wrote:

> Hi Robert,
>
> I've just implemented part of the GL_EXT_draw_buffers2 extension in
> osg::BlendFunc, which is necessary especially for deferred shading use. It
> enables developers to decide which of the multiple rendering targets (MRT)
> can be affected by blending function. Those targets disabling blending are
> always treated as to save extra geometry attributes in all 4 channels
> rather than opacity.
>
> This submissions is originated from the following topic in the mail list:
> http://forum.openscenegraph.org/viewtopic.php?t=13057
>
> And about the extension:
> http://www.opengl.org/registry/specs/EXT/draw_buffers2.txt
>
> A new osgblenddrawbuffers example is also submitted to show the importance
> and usage of the new functionalities.
>
> Cheers,
>
> Wang Rui
>
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to