[osg-users] Trying to add an osg::CameraNode to a node
Brian
bpdavis at knology.net
Fri Jul 20 19:02:14 PDT 2007
Hi,
Up until earlier this week, I have successfully used camera nodes to render a scene to a texture. I would take that texture and pass it to another function that would render it using straight OpenGL to a 2D scene. On top of the RTT texture, a transparent overlay would be applied as a HUD. It worked great, and life was good.
Recently, I have been given a model that I must now attach the RTT texture to. I have created a NodeVisitor for the model and have successfully replaced the node's original texture with the RTT texture. However, the HUD is no longer rendered as it is not part of the model.
I think that the best approach would be to use a drawable to render the HUD, but because the HUD consists of several 2D textures (straight OpenGL here, no Texture2D objects,) I would like to render the HUD to a separate texture. Once the rendering completes, I could take the rendered HUD texture and overlay it on top of the main RTT texture as before.
The problem that I'm faced with is how to set up a drawable and associate a camera node with it so that I can render the HUD to a texture. I've created a class for the drawable and have added it to the node visitor's node. I've created a camera node for rendering the HUD. I cannot however figure out a way to add the camera node to the drawable so that the scene knows about it. Additionally, I am guessing that the above additions to the node would not be correct. Instead, I think that something like...
node visitor's node
|
camera node
|
drawable
... would be more appropriate. The problem is figuring out how to construct the tree in code.
Perhaps I am going about this the wrong way? Any thoughts/suggestions would be greatly appreciated.
Thanks,
Brian
More information about the osg-users
mailing list