[osg-users] Wait for camera to finish rendering

49 views
Skip to first unread message

Marko Srebre

unread,
Jun 19, 2013, 8:34:04 AM6/19/13
to osg-...@lists.openscenegraph.org
Hello,

I am having a compute pipeline (physics simulation) that ends with a camera that renders to an image (for further processing on cpu). I'd like the Viewer::frame() to exit only after the image has been rendered to, so that update traversal happens after the data has been downloaded to image.

I am familiar with the workings of


Code:
setDataVariance(osg::Object::DYNAMIC),



but this unfortunately applies to drawables, not the output image. If I set data variance to dynamic, the frame() will wait to process the drawables for the camera node, but exit right after, not waiting for the render to image to finish. The only way I could figure out, to make it wait, is to set up a dummy camera (with dynamic variance) with a render order right after my image-camera. That works, but I was hoping there is nicer solution to this problem that I am missing.

I was also considering camera PostDraw callback, but it doesn't really solve the problem, since the downloaded data won't be available in the next frame update travesal.

If anyone can share some experience on this matter, I'd appreciate it. Thanks.

Cheers,
Marko

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





_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Robert Osfield

unread,
Jun 20, 2013, 6:53:24 AM6/20/13
to OpenSceneGraph Users
Hi Marko,

You could use a Camera::FinalDrawCallback to sync, or simply run the
viewer in CullThreadPerContext or SingleThreaded threading model.
It's only the default DrawThreadPerContext (default on multi-core
systems) and CullThreadPerCameraDrawThreadPerContext threading models
that allow the next frame to start while static objects are still
being drawn.

Robert.
Reply all
Reply to author
Forward
0 new messages