[osg-users] Fix for clear mask inheritance (was: Re: Problem with Camera::inheritCullSettings)

Paul Martz pmartz at skew-matrix.com
Thu Nov 26 08:40:14 PST 2009


Hi Robert -- Thanks for the help. Attached is my fix for this issue, and 
I've verified that it works for my test case.

For the change log:

This change address the following issue: an app opens a Viewer on a 
multidisplay system, configured to setUpViewAcrossAllDisplays, with a 
non-default clear mask. In this case, OSG failed to propagate the clear 
mask to the slave Cameras, resulting in the clear mask being ignored. To 
fix this issue, this revision adds a new CullSettings::VariablesMask 
bit, CLEAR_MASK, to explicitly control inheritance of the clear mask. 
This bit is set by default, which means that the clear mask now inherits 
by default, whereas previously it did not.

Thanks,

Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ <http://www.skew-matrix.com/>
+1 303 859 9466



Robert Osfield wrote:
> HI Paul,
> 
> My inclination would be to add an extra CullSettings inheritance mask
> value for inheriting the ClearMask - as this would fit the way that
> other variables are inherited down.
> 
> As for the naming of inheritCullSettings, I do also feel that it's not
> perfect for conveying what it does, as ordinarily we would think of
> cull to do just with scene graph traversal, rather than traversal of
> the topmost Camera.  However, in implementation these settings control
> what happens in the cull phase, and this does encompass traversal of
> cameras as well as the scene graph. Given this I think it's not too
> bad a naming.
> 
> Robert.
> 
> On Wed, Nov 25, 2009 at 5:13 PM, Paul Martz <pmartz at skew-matrix.com> wrote:
>> Hi Robert -- I've encountered a problem with how parent Camera values
>> inherit down to slave Cameras, and wanted to discuss it before I launched
>> into coding a fix.
>>
>> Quick summary: master Camera clear mask doesn't inherit down to slave
>> Cameras. As a workaround, I can loop over slave Cameras and set the clear
>> mask manually.
>>
>> Example use case: On a multidisplay system, create a Viewer configured to
>> setUpViewAcrossAllDisplays. Get the Viewer's Camera, set the clear color to
>> blue and set the clear mask to 0. Then call run. The windows incorrectly
>> clear to blue -- they shouldn't clear at all, because the clear mask is set
>> to 0.
>>
>> I managed to divine that slave Cameras get their clear colors set in
>> Camera::inheritCullSettings, if the CLEAR_COLOR bit is set. If I modify this
>> code to also copy the master Camera clear mask down to the slave Camera,
>> then I get the expected result (no clearing occurs).
>>
>> It seems like there are two ways to fix this: One is to just piggyback clear
>> mask onto the CLEAR_COLOR bit, or we could also add another bit specifically
>> for clear mask.
>>
>> The second way, I'm not sure about. But the name "inheritCullSettings" fails
>> to imply that clear color, possibly clear mask, read buffer, and draw buffer
>> are all set in that function. So I wonder if inheritCullSettings is the
>> right place to inherit these values? Or should master-to-slave value setting
>> be done somewhere else?
>>
>> I'd appreciate your input on this, and I'd be glad to code a solution if you
>> can provide some direction. Thanks.
>> --
>> Paul Martz
>> Skew Matrix Software LLC
>> _http://www.skew-matrix.com_ <http://www.skew-matrix.com/>
>> +1 303 859 9466
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clearmask.zip
Type: application/x-zip-compressed
Size: 23593 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20091126/ae9cfbf5/attachment.bin>


More information about the osg-users mailing list