Thanks very much Robert. Your explanation fits everything I've observed. Time to get 1.9.7 installed.
Bob Robert Osfield wrote: > > Hi Bob, > > The way that osgProducer integrates OSG and Producer is by having a > single call from Producer run the cull and draw for each camera (via > the OsgSceneHandler), this single call will rendering everything in > the scene graph - both the scene graph and the HUD. After this call > Producer will call its post draw callbacks, which explains the one > frame delay. > > In 1.9.7 the osg::Camera objects that you use support both a Camera > pre and post draw callback, and these will be called entirely with the > OSG side cull-draw traversals that the OsgSceneHandler will dispatch. > This will give you the option of adding a Pre draw callback to the > front of the HUD camera so that it can grab the image before its > drawing is done. > > Using the above approach will work with either osgProducer or > osgViewer based apps, but.. you'll need to use 1.9.7 or the SVN for > this feature. > > Robert. > > On 6/5/07, Robert Doyle <[EMAIL PROTECTED]> wrote: > > > > Hello OSG Users: > > > > I have a scene with a HUD. The HUD overlays the scene with an image > > created by rendering the scene. Both the scene and the HUD need to be > > rendered in the same frame. Everything works exactly as it should except > > that the HUD image is updated one frame late. The scenegraph is: > > > > root->addChild(sceneNode); > > root->addChild(HUDCamera); // Note: osg::CameraNode::POST_RENDER > > HUDCamera->addChild(HUDNode); > > viewer.setSceneData(root); // Note: osgProducer::Viewer viewer > > > > The setup is very similar to osgprerender except the rendering order is > > reversed; I need to view and manipulate the scene. > > > > The sequence of events is: > > 1. Render the scene with the Producer camera. > > 2. Get the modelview, projection, and window matrices in the scene node > > cull callback. > > 3. Read the depth buffer in the Producer camera's post-draw callback. > > 4. While still in the camera's post-draw callback: rewrite the HUD > > texture image to memory with algorithms using the matrices and the depth > > information. Dirty the image. > > 5. Render the HUD using the osg::CameraNode. > > > > I've confirmed that matrix values and Z-buffer values are frame > > accurate. I slowed down the frame rate and set the Producer camera to > > translate left and right every 10 frames. Printed output shows values > > changing when they should change. However, the HUD image moves one frame > > later than the scene. This leads me to conclude that the texture image > > is not subloading until the next frame. > > > > I've attempted to dirty the image in an update callback from the HUD > > camera but there's no change. So, I either need to find a way to force > > an image subload or I need to correct my misunderstanding of how an > > osg::CameraNode works in this scenegraph. I can't upgrade OSG with the > > new camera for some time. > > > > Thanks, > > Bob Doyle > > _______________________________________________ > > osg-users mailing list > > [email protected] > > http://openscenegraph.net/mailman/listinfo/osg-users > > http://www.openscenegraph.org/ > > > _______________________________________________ > osg-users mailing list > [email protected] > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ -- Robert J. Doyle, Jr. Code 5594 Center for Computational Science U.S. Naval Research Laboratory 4555 Overlook Ave., S.W. Washington, DC 20375-5320 e-mail: [EMAIL PROTECTED] SIPR: [EMAIL PROTECTED] phone: 202-767-8395 fax: 202-404-7402 _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
