在 2012-7-2,22:48,"Fan ZHANG" <[email protected]> 写道:
> Hi all, > > I'm quite new to OSG and have no OPENGL background. > > I want to know how to acquire the current location information of a drawable > object? > Actually the initial position of the geometry is set by me. But when I move > the objects with mouse, the spatial information changes, right? So I want to > acquire such information. > the world coordinate of a drawable is determined by scene graph. So it's world coordinate never change before you change the scene graph, logically. What you see after mouse action is probably controlled by view matrix and projection matrix. The pipeline looks like: object coordinate --> world coordinate --> eye coordinate --> device coordinate --> window coordinate. View matrix affects the eye coordinate and projection matrix affects the device coordinate. Mouse action will change the two matrixes. osg::Camera maintains these matrixes. > For the second question, how to calculate the distance between an object and > the viewpoint? Because I want to differentiate the 'stateset' when objects > are far away from the viewpoint and when they are close to the camera. And I > don't even know where the camera viewpoint is! > viewpoint can be accessed in CullVisitor, so you should get it in cull traversal, by defining a cull callback and adding it to a Node. > Regards and thank you! > > Cheers, > Fan > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=48628#48628 > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

