Hi,

I use a camera to render my main graph to an FBO.
Then I render this FBO to screen with another camera and a quad.

Like this :


Code:
Main camera (render to FBO)
|
|-- Main graph
|
|--- Camera (render to screen)
       |
       |- Quad




I try to setup multisampling for the main camera :


Code:
p_camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
p_camera->attach(osg::Camera::COLOR_BUFFER, p_renderTextureColor, 0, 0, false, 
4, 4);
p_camera->attach(osg::Camera::DEPTH_BUFFER, p_renderTextureDepth, 0, 0, false, 
4, 4);




I also try to set "sampleBuffers" and "samples" on the traits before creating 
context, but all I get is a black screen.

When I render to screen, MSAA works great, but how to configure it for a FBO 
target ?

My textures are created as follow :


Code:
// Main color texture
p_renderTextureColor = new osg::Texture2D();
p_renderTextureColor->setTextureSize(p_osgViewport->width(), 
p_osgViewport->height());
p_renderTextureColor->setInternalFormat(GL_RGBA32F_ARB);
p_renderTextureColor->setSourceFormat(GL_RGBA);
p_renderTextureColor->setSourceType(GL_FLOAT);
p_renderTextureColor->setFilter(osg::Texture2D::MIN_FILTER, 
osg::Texture2D::NEAREST);
p_renderTextureColor->setFilter(osg::Texture2D::MAG_FILTER, 
osg::Texture2D::NEAREST);
p_renderTextureDepth->setWrap(osg::Texture::WRAP_S, 
osg::Texture::CLAMP_TO_EDGE);
p_renderTextureDepth->setWrap(osg::Texture::WRAP_T, 
osg::Texture::CLAMP_TO_EDGE);

// Main depth texture
p_renderTextureDepth = new osg::Texture2D();
p_renderTextureDepth->setTextureSize(p_osgViewport->width(), 
p_osgViewport->height());
p_renderTextureDepth->setSourceFormat(GL_DEPTH_COMPONENT);
p_renderTextureDepth->setSourceType(GL_FLOAT);
p_renderTextureDepth->setInternalFormat(GL_DEPTH_COMPONENT32F);
p_renderTextureDepth->setFilter(osg::Texture2D::MIN_FILTER, 
osg::Texture2D::NEAREST);
p_renderTextureDepth->setFilter(osg::Texture2D::MAG_FILTER, 
osg::Texture2D::NEAREST);
p_renderTextureDepth->setWrap(osg::Texture::WRAP_S, 
osg::Texture::CLAMP_TO_EDGE);
p_renderTextureDepth->setWrap(osg::Texture::WRAP_T, 
osg::Texture::CLAMP_TO_EDGE);




Any help would be greatly appreciated.

Aurelien

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





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

Reply via email to