Hello all! Allow me to talk briefly about osgWidget's current design and perhaps how I can change it for the better.
A number of people over the last few months have asked me why the WindowManager object requires an osgViewer::View* to be created. This is an interesting question, and it segues into something possibly more complicated, and which potentially demonstrates my lack of understanding of some things related to OSG. :) To summarize, a WindowManager object in osgWidget is derived from osg::Switch, and its purpose is to position and layer various Window objects which are added to it. It does this in a kind of "virtual space"--that is to say, it has no awareness of how it will be viewed, and I leave that aspect up to the user. Windows in osgWidget are derived from osg::MatrixTransform, so it is quite simple to position and size these objects in a virtual space. However, as I mentioned earlier, when created a WindowManager must have access to an osgViewer::View* so that it can call the computeInteresections() method on this pointer and perform proper picking. This raises an interesting design question: what exactly is (or should be) the relationship between a WindowManager and an osg::Camera? There certainly is SOME relationship, but whether or not I am properly utilizing it in osgWidget remains to be seen. If any of you have used osgWidget you may be familiar with the following convenience method: osgWidget::WindowManager::createParentOrthoCamera() What this member/method does is creates an orthographic 2D camera, adds the "this" pointer as it's first child, and returns the newly created Camera. This is a quick way to put the WindowManager object in a state where it can be seen and behaves as expected, but I fear I may have this all only "accidentally" working. My question, then, is to the OSG Gurus: if you were designing osgWidget, how would you model this relationship between the topmost osgWidget "manager" object and the Camera to which it should be attached? Would you use an osgViewer::View* like I do to perform picking, or would you interface directly with the Camera and perform picking that way? If so, the question of WindowManager->Camera relationship becomes even more important. Furthermore, how would you handle 3D GUI objects, which can certainly be added to a WindowManager's "virtual" space, but will appear wildly differently depending on whether the object is viewed through an orthographic or perspective camera? (Please forgive me if I'm using some wrong terminology here, I hope I get the idea across!) _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org