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/

Reply via email to