[osg-users] Problem with Camera::inheritCullSettings

Paul Martz pmartz at skew-matrix.com
Wed Nov 25 09:13:14 PST 2009

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

More information about the osg-users mailing list