[osg-users] Building an Altimeter

Chris 'Xenon' Hanson xenon at alphapixel.com
Sat Apr 9 18:13:28 PDT 2011

On 4/9/2011 2:44 PM, Rusty Shackleford wrote:
> Hi,
> I'm working on a tool that visualizes a spacecraft in orbit around a planetary body. As it is set up now, the position of that spacecraft is given relative to the center of the body as an x,y,z coordinate. What I'm trying to do right now is set up a simple altimeter that looks essentially like a ruler reaching from the planetary surface up to a little past the spacecraft. That is, a straight line with perpendicular lines crossing it at regular intervals.

  Is this a 3D thing that lives in the world with the spacecraft, or a 2D thing on screen?

  If it's 2D, there's an example called osgScalarBar that might be a starting point to
gain inspiration from.

> I'm VERY new at OSG (two weeks in) so I could be going about this completely wrong, please let me know if so. What needs to happen is for the altimeter to follow the spacecraft (position given by "end" in the code) such that the central line always intersects it and the origin stays at the center of the planet (given by "start").

  You can turn off lighting as a stateset to make it always remain fully lit. Osg Text has
Autotransform capabilities built in to keep it always facing the camera.

Chris 'Xenon' Hanson, omo sanza lettere. Xenon at AlphaPixel.com http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. Contracting.
    "There is no Truth. There is only Perception. To Perceive is to Exist." - Xen

More information about the osg-users mailing list