Yes it's quite confusing.
The RenderStage code was already set up as follows: If doing MSFBO (and
therefore need two FBOs, one for multisampled rendering and one for
final resolve), then configure "fbo" as the resolve FBO, and When done
configuring, swap it into "_resolveFbo" (see line 554). But, if not
using MSFBO, then "fbo" is just the render fbo.
(I did not write this code, I am just the poor sap left to maintain it. :-)
My code handles this correctly: If using MSFBO, then resolveBuffersMask
is the value set by the app for the resolve buffers. But if not using
MSFBO, then resolveBuffersMask is the value set by the app for render
buffers. In both cases, resolveBuffersMask is used to configure "fbo".
So, my code is correct, in light of how the existing code is written.
I attempted to explain this briefly in code comments at lines 349-351
and also lines 377-378, but perhaps to clarify things further, you could
paste this email from me as a code comment about line 442.
Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ <http://www.skew-matrix.com/>
+1 303 859 9466
Wojciech Lewandowski wrote:
Hi Paul,
Thanks. I am almost done with modifications for DisplaySettings. I have
to test it and will submit the code tomorrow. But I have one question
regarding your changes in RenderStage.cpp. I have understood that
RenderMask defines implicit attachments for main FBO and ResolveMask
defines implicit attachments for multisample FBO. I noticed that
when multisampling is not used both masks are actually set to RenderMask
value (RenderStage.cpp line 352). But when multisampling is on, it looks
like masks are swapped because ResolveMask is used to force implicit
buffers for main FBO and RenderMask is used to force implicit buffers
for MS FBO. Its bit surprising to me, but maybe its correct ?
For example: see excerpt from RenderStage lines 440-455
if (!depthAttached)
{
if( resolveBuffersMask & osg::Camera::USE_DEPTH_BUFFER )
{
fbo->setAttachment(osg::Camera::DEPTH_BUFFER,
osg::FrameBufferAttachment(new osg::RenderBuffer(width,
height, GL_DEPTH_COMPONENT24)));
depthAttached = true;
}
if (fbo_multisample.valid() &&
( renderBuffersMask & osg::Camera::USE_DEPTH_BUFFER ) )
{
fbo_multisample->setAttachment(osg::Camera::DEPTH_BUFFER,
osg::FrameBufferAttachment(new osg::RenderBuffer(width,
height, GL_DEPTH_COMPONENT24, samples, colorSamples)));
depthAttached = true;
}
}
Cheers,
Wojtek Lewandowski
----- Original Message -----
From: "Paul Martz" <pma...@skew-matrix.com <mailto:pma...@skew-matrix.com>>
To: "OpenSceneGraph Users" <osg-users@lists.openscenegraph.org
<mailto:osg-users@lists.openscenegraph.org>>
Sent: Monday, October 26, 2009 2:56 PM
Subject: Re: [osg-users] Improving multisampled FBO
> Wojciech Lewandowski wrote:
>> I will prepare and submit a code with these modifications if you accept
>> general direction.
>
> Sounds good to me, please go ahead and make these changes (including the
> entry point name change). And thanks for the help with this.
> -Paul
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
<mailto:osg-users@lists.openscenegraph.org>
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
------------------------------------------------------------------------
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org