[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] converting "object position" to "view position" in (py)opengl



I would just billboard a texture with the text at the object's center
with DEPTH_TEST disabled, so it draws over it.

See http://www.lighthouse3d.com/opengl/billboarding/index.php3?billCheat

Alternatively, you could use gluProject to get the window coordinates
of the object's center, but I think it's best to not do pixel
operations.

On Wed, Jul 1, 2009 at 12:31 AM, Tyler Laing<trinioler@xxxxxxxxx> wrote:
> Hmm, I'm not 100% familiar with 3d programming, but wouldn't the best way be
> to find the cross-section of the object at some distance from the camera,
> which would be a 2d shape, and then you can center the text on that shape?
>
> On Tue, Jun 30, 2009 at 9:26 PM, Astan Chee <astan.chee@xxxxxxxxx> 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.
>> Thanks for any help
>> Astan
>
>
>
> --
> Visit my blog at http://oddco.ca/zeroth/zblog
>