Hi Roger,
Did you try to run addSlave & removeSlave wrapped in stopThreading /
startThreading call ? We recently learned in similar case like yours
(postrender HUD), that its really needed if slave is added/removed after
realize. Without this Update traversal was entering the graph while
Cull/Draw traversals were active in other thread.
Wojtek
-----Oryginalna wiadomość-----
From: Roger James
Sent: Saturday, February 12, 2011 1:19 PM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Main frame buffer corruption when using a slave
camerato POST_RENDER to a FBO
Hi,
I am seeing a a strange corruption of the main frame buffer when I use a
slave camera to render to a frame buffer object and set the camera render
order to POST_RENDER. The camera is set up like this.
Code:
pCamera->setClearColor(pViewer->getCamera()->getClearColor());
pCamera->setViewport(0, 0, Width, Height);
pCamera->setRenderOrder(osg::Camera::POST_RENDER);
pCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT,
osg::Camera::FRAME_BUFFER);
pCamera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR);
pCamera->attach(osg::Camera::COLOR_BUFFER, pImage.get());
pCamera->setGraphicsContext(pViewer->getCamera()->getGraphicsContext());
// pViewer->stopThreading(); It seems to work without this, but Robert says
it is needed, maybe it is not always needed for simple setups
pViewer->addSlave(pCamera.get());
pViewer->frame();
pViewer->removeSlave(pViewer->findSlaveIndexForCamera(pCamera.get()));
// pViewer->startThreading();
Immediately aftere this code has executed and before the next frame the the
main frame buffer scene has had a white half circle painted over it in
approximately the top third of the viewport. If I don't remove the slave
camera and allow it to render in following frames the white half circle
still dissappears on the following frames.
I can fix this by setting the slave camera to PRE_RENDER in this case. But I
am really puzzled by this behaviour. Does anyone have any idea on what is
happening here? Why should a camera that has been set to render to a FBO be
causing things to be drawn in the real frame buffer?
Roger
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=36577#36577
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org