Hi Vic,

Thank you! That appears to work! It allows me to open several windows at once, 
though the program (and the windows that open) are not responsive for some 
reason. Could be my fault, not sure.
How do I associate a osgViewer::Viewer with a osg::GraphicsContext so that it 
renders inside of that specific window?

You set the graphics context on a camera.

In your case, if you always have only one view open at a time, you'll be using an osgViewer::Viewer, which derives from osgViewer::View, which has a camera (viewer->getCamera() will get it). You call viewer->getCamera()->setGraphicsContext(gc) to use it.

If you had to have multiple views (which can each be in separate windows or not) open and rendering at the same time, you'd want a CompositeViewer, which has a list of osgViewer::Views, each of which has a camera, which can use the same or different graphics contexts.

Another thing... simplified description of how I have set it up: I'm using a 
game loop that checks a global boolean g_quit variable and inside it I'm 
calling the frame() method of my osgViewer::Viewer object among other things. 
Most examples I have seen are using the run() method but that seems to have 
loop in itself so it's not applicable here. Is frame() the preferable way to do 
this? Does it automatically update, cull, draw through that method? I want to 
see if I have got this right.

Check the code for osgViewer::Viewer::run(), which calls osgViewer::ViewerBase::run(), which calls osgViewer::ViewerBase::frame(). You'll see that it calls everything that's needed. If you want to, you can reimplement your loop the same way (for example if you need to do things between the cull and draw traversals).

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    [email protected]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to