>How did you test that setting both to 4 didn't work?
This is how I tested it:
// Reading back the FBO does not work when it is disabled after render -->
set this property of the
// renderStage to false. A workaround is to enable
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBufferObjectID) in the draw
callback
osgViewer::Renderer * renderer =
static_cast<osgViewer::Renderer*>(camera->getRenderer());
renderer->getSceneView(0)->getRenderStage()->setDisableFboAfterRender(false);
renderer->getSceneView(1)->getRenderStage()->setDisableFboAfterRender(false);
...
// Camera and texture setup
osg::ref_ptr<osg::TextureRectangle> offscreenTexture = new
osg::TextureRectangle;
offscreenTexture->setTextureSize(500, 500);
offscreenTexture->setSourceFormat(GL_RGBA);
offscreenTexture->setSourceType(GL_FLOAT);
offscreenTexture->setInternalFormat(GL_FLOAT_RGBA32_NV);
camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
camera->attach(osg::Camera::COLOR_BUFFER0,
offscreenTexture.get(),0,0,false,4,4);
camera->setFinalDrawCallback(new MyCameraDrawCallback(precision));
...
// the color is set by using a fragment shader and a uniform variable
osg::Vec4 geodeColorf = osg::Vec4(56.13,0,0,1);
osg::ref_ptr<osg::Uniform> redColor = new osg::Uniform( "Color",
geodeColorf);
stateset->addUniform(redColor.get());
stateset->setAttributeAndModes( program.get(), osg::StateAttribute::ON |
osg::StateAttribute::OVERRIDE );
aDrawable->setStateSet(stateset);
// Code in my fragment shader
uniform vec4 Color;
void main (void)
{
gl_FragColor = Color;
}
...
// code in MyCameraDrawCallback
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
float* tempbuf32Bits = NULL;
tempbuf32Bits = new float[500*500];
glReadPixels(0, 0, WIDTH, HEIGHT, GL_RED, GL_FLOAT, tempbuf32Bits);
All pixels that I read back are set to -431602080 (not the intended value).
If I called camera->attach(osg::Camera::COLOR_BUFFER0,
offscreenTexture.get(),0,0,false,0,0) it is working (without multisampling)
>Note that the osg::Texture will not be multisampled because the multisample
>RenderBuffers are resolved during the blit to texture.
You mean that this is no way to get multisample when using my
osg::TextureRectangle? It so, what are the alternatives? Using a osg::Image?
Ideally I need to support 32 bits floating point blending and multisampling
in my project. Do you think this is possible?
Thanks you
Jonathan
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org