Jonathan Richard wrote on Monday, July 06, 2009 4:04 PM:
> Ok I was able to get it working by getting the resolved fbo using the 
> RenderStage::getMultisampleResolveFramebufferObject method. Here a
subset of
> my code in the draw callback:  
> 
> 
>   osgViewer::Renderer * renderer =
>
static_cast<osgViewer::Renderer*>(renderInfo.getCurrentCamera()->getRend
erer());
> 
>     osg::FrameBufferObject *fbo=NULL;
> 
>    
>
fbo=renderer->getSceneView(0)->getRenderStage()->getMultisampleResolveFr
amebufferObject();
> 
>     // Bind the fbo to be read
>     fbo->apply(state,osg::FrameBufferObject::READ_FRAMEBUFFER);
> 
>     // Specify a color buffer as the source for the subsequent call of
>     glReadPixel glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
> 
>   float* tempbuf32Bits = new float[WIDTH*HEIGHT];
>  glReadPixels(0, 0, WIDTH, HEIGHT, GL_RED, GL_FLOAT, tempbuf32Bits);

Glad you got it working!

Is there a reason you didn't just attach an osg::Texture to your camera
and set the number of samples greater than 1 in the attach call?

By the way, if you change OpenGL state, be careful that you restore the
previous state or tell OpenSceneGraph about the changes you make (via
haveAppliedMode(), haveAppliedAttribute(), etc.); otherwise
OpenSceneGraph will get confused about what the current OpenGL state is.

-- 
Bryan Thrall
FlightSafety International
bryan.thr...@flightsafety.com
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to