Hi all,

I would like to know how to get multiple slave cameras to successively render 
to the same texture using multisampling. I've looked at every osg example, but 
multisampled FBOs are only discussed in the context of a single rendering 
camera.

Without multisampling life is simple. For example if I have 2 cameras attached 
to the same color texture, then everything works fine, like this:

Code:

backCamera = new Texture2D(); // Also perform texture setup...
backCamera->setRenderOrder(Camera::PRE_RENDER, 0); // Render first
backCamera->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
backCamera->attach(Camera::COLOR_BUFFER0, colorTex);

frontCamera = new Texture2D(); // Also perform texture setup...
frontCamera->setRenderOrder(Camera::PRE_RENDER, 1); // Render after backCamera
frontCamera->setClearMask(GL_DEPTH_BUFFER_BIT); // Don't erase backCamera's 
results
frontCamera->attach(Camera::COLOR_BUFFER0, colorTex);



Unless I'm mistaken, this setup works because the FBOs for both cameras render 
directly to colorTex, and frontCamera is set to not clear the color buffer.

Now, I want to enable multisampling for frontCamera. I tried simply adding the 
samples/colorsamples argument to attach(), like so:

Code:

frontCamera->attach(Camera::COLOR_BUFFER0, colorTex, 0, 0, false, 2, 2); // 2 
samples & colorsamples



This results in the frontCamera's FBO overwriting colorTex entirely, so the 
backCamera's results are erased. It seems this happens because frontCamera 
internally renders to a multisampled renderbuffer, then blits this onto 
colorTex, which overwrites the texture's contents.

So this brings me back to my original question: how do I get the 
multisample-enabled frontCamera to render ON TOP OF its attached texture 
instead of overwriting it? Is there a way to "initialize" its renderbuffers 
with the contents of the texture?

I briefly tried going down the path of using Texture2DMultisample, but there 
are no examples of that so I didn't get very far.

Thank you!
Ravi

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70464#70464





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

Reply via email to