Hi John,

In SceneView you'll find teh following methods:

       /** Calculate the object coordinates of a point in window coordinates.
           Note, current implementation requires that
SceneView::draw() has been previously called
           for projectWindowIntoObject to produce valid values.
Consistent with OpenGL
           windows coordinates are calculated relative to the bottom
left of the window.
           Returns true on successful projection.
       */
       bool projectWindowIntoObject(const osg::Vec3&
window,osg::Vec3& object) const;

       /** Calculate the object coordinates of a window x,y when
projected onto the near and far planes.
           Note, current implementation requires that
SceneView::draw() has been previously called
           for projectWindowIntoObject to produce valid values.
Consistent with OpenGL
           windows coordinates are calculated relative to the bottom
left of the window.
           Returns true on successful projection.
       */
       bool projectWindowXYIntoObject(int x,int y,osg::Vec3&
near_point,osg::Vec3& far_point) const;

       /** Calculate the window coordinates of a point in object coordinates.
           Note, current implementation requires that
SceneView::draw() has been previously called
           for projectWindowIntoObject to produce valid values.
Consistent with OpenGL
           windows coordinates are calculated relative to the bottom
left of the window,
           whereas window API's normally have the top left as the origin,
           so you may need to pass in (mouseX,window_height-mouseY,...).
           Returns true on successful projection.
       */
       bool projectObjectIntoWindow(const osg::Vec3&
object,osg::Vec3& window) const;


These are just built ontop of osg::Matrix* operations involving the
viewport/window matrices projection and view - have a look at the
implementation in src/osgUtil/SceneView.cpp to see what I mean.
Bascially you can do it all just from matrices yourself, no need to
call OpenGL.

Robert.

On 12/4/06, Whitfield, John M. (SED/TMI)
<[EMAIL PROTECTED]> wrote:
Hello,

Does anyone know how to implement something similar to the glu function
gluUnProject in openscenegraph.

Thanks,
-John
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to