Hi David,

I'm using the MVPW routine to convert a point 3D perspective so I can display a 
marker on to my Ortho2D heads up display camera:

Just wondering, do you use this:

hudCamera->setProjectionResizePolicy(osg::Camera::FIXED)

It all depends on how you've set things up and how you want things to behave. If you set as above, the projection will not change even if your viewport changes size. This won't work if your marker in your HUD is meant to follow some other object in the 3D scene, whose camera has a different projection resize policy... Try the different policies and see how they work for you, or check your main camera to see which policy it uses (perhaps the default which is HORIZONTAL).

On the other hand, you might have to save your 3D points somewhere and reproject them when the window gets resized. You can either wire that in your resizeGL function, or you can add a ResizedCallback to your GraphicsContext (GraphicsWindow).

It can be a pain to get everything match up correctly, but once you understand how things fit together it all makes sense. You may also want to place breakpoints and inspect the projection matrices (or the result of getProjectionMatrixAsOrtho(), which is easier to interpret :-) ) before and after the resize, and you'll understand what's going on.

One page I like on the subject is

http://www.songho.ca/opengl/gl_projectionmatrix.html

it has nice diagrams, easy to read text and the math is well explained.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to