Jonathan Richard wrote on Monday, June 29, 2009 2:19 PM: >> How did you test that setting both to 4 didn't work? > > This is how I tested it: ... > // 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)
glReadPixels does not work with a multisample FBO (check glGetError after your glReadPixels to see); you have to use glBlitFramebuffer to copy the multisample FBO to a FBO without multisampling to resolve the samples to a texture; this is what osgUtil::RenderStage does when you attach an osg::Texture and set the samples to > 1. >> 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? In OpenGL, AFAIK, there is no way to get a multisample texture (and OpenGL doesn't do multisampling when it samples a texture either). If you just want to render to multisample buffers and never need to read back from those buffers (such as in a shader), you can do it; otherwise, I think you are out of luck. Wish it were different, because I'd love to have the ability to read multisample textures too! -- Bryan Thrall FlightSafety International [email protected] _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

