Re: [PyOpenGL-Users] converting "object position" to "view position" in (py)opengl
Brought to you by:
mcfletch
From: Dirk R. <dir...@gm...> - 2009-07-01 20:38:17
|
Hi Astan, Astan Chee wrote: > Hi, > Im relatively new to opengl and I'm not familiat with its jargon but > what I have is objects in a 3D world in various positions and a camera > that can "move" around. What I'm trying to do is if the distance between > object and camera is close enough, display some information on the > screen on the object. > I know how to calculate distance and I know how to print/display text in > opengl (I'm using glOrtho and glRasterPos2i to map out the characters > one at a time). > Anyway, what I'm having problems with is how do I calculate where to > display these information on the screen so that it overlaps the object > (assuming I know the distance and the angle of the camera and the object > relative to the camera). Does this make sense? I've attached an image > that I photoshopped to look like what I'm trying to do. What are you using to draw the characters? glBitmap? Your use of glRasterPos2i hints at that. In that case you can just ignore the glOrtho and use glRasterPos3f to position your text in the 3D scene (e.g. in the center of the object). The main difficulty is putting the chacaters next to each other, and glBitmap takes care of that nicely. If you're using a different method things get a little more complicated (but not too much, really). Dirk |