Hi Jeremy,
Everyone asks about this, so I'll try and put a comment in the code
somewhere to explain it. The bottom line is that it simply isn't
possible to create a pixel-aligned 2D interface in OSG without at least
initially forcing a window size. Sure, I could rely on whatever size the
user sets in their environment, but I need some way to keep the
orthorgraphic camera in sync with the actual dimensions of the
application window itself.
Normally, you rely on the RESIZE event in osgGA to inform you of this,
and for the most part it works (see src/osgWidget/ViewerEventHandlers)
for keeping you in sync with the size of the window. However, a RESIZE
event isn't generate for the initial size of the window, nor is it
generated when the window is asked to go into "fullscreen" mode.
Until there is some global way of "hooking" into the intial (and any
subsequent changes thereafter) window dimensions in a reliable way, we
simply have no choice. I spent an afternoon trying to get around this
with no avail. If someone can tell me how to get the initial window
size, I'll be more than happy to patch osgWidget. :) (I've posted asking
about this in the past with no response.) Until then, I do the best I
can with what I've got.
The requirement to have the size at startup makes sense. I have no
problem with that. (but thanks for explaining, it's always useful to
have a better understanding of the "why").
What I have problems with is putting the window's top-left corner at
(0,0). You can change that without affecting the window's size...
viewer.setUpViewInSingleScreen(50, 50, w, h);
As for letting the viewer set itself up, there should be ways of getting
the size of the window after viewer.realize():
* Get the viewport of the main viewer camera
(viewer.getCamera()->getViewport()).
* Or get the graphics context and get the size from there.
* Or ...
But as I said, my major concern is putting the window at (0,0). I would
find it more "polite" if your examples let the viewer decide, but if
that's just not possible, at the very least place the window in a sane
initial position.
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