PDA

View Full Version : Always Point to Camera



11-05-2002, 04:34 AM
Hello,

How do I make a polygon (quad, or sprite-like polygon) always be pointing to the camera? I believe this has something to do with matrices and getting vectors from the modelview matrix, but I'm kinda inexperienced with matrix operation/information.

Thanks.

nexusone
11-05-2002, 05:28 AM
Are you talking about billboarding?
Or sort of like an overlay, like a space ship's control's or user stat's.

In billboarding you just rotate the object in reference to the camera position, look at vector math, sin/cos.

Like an overlay would work like this...
Just draw it before using gluLookAt or glRotate or gltranslate.
Only thing drawn after will be moved.



Originally posted by JohnnyM:
Hello,

How do I make a polygon (quad, or sprite-like polygon) always be pointing to the camera? I believe this has something to do with matrices and getting vectors from the modelview matrix, but I'm kinda inexperienced with matrix operation/information.

Thanks.

nomad82
11-05-2002, 06:16 AM
i think he meant billboarding...anyway, if it's billboarding, search around the net for it, there're lots of sites about it (and codes too! =) ).

if it's overlay, well, i have a diff. way of creating an overlay than nexusone, i push my matrices and then switch to ortho mode, then draw whatever i want to draw in 2d (like mouse cursor =) ), then switch back to perspective mode...i think there's a tutorial on this at gametutorials.com (not sure though)...i thought of this method myself after needing a mouse cursor... http://www.opengl.org/discussion_boards/ubb/smile.gif.

nexusone
11-05-2002, 06:23 AM
I also do that switching between ortho and perspective, when using bitmap text.

http://www.opengl.org/discussion_boards/ubb/smile.gif


Originally posted by nomad82:
i think he meant billboarding...anyway, if it's billboarding, search around the net for it, there're lots of sites about it (and codes too! =) ).

if it's overlay, well, i have a diff. way of creating an overlay than nexusone, i push my matrices and then switch to ortho mode, then draw whatever i want to draw in 2d (like mouse cursor =) ), then switch back to perspective mode...i think there's a tutorial on this at gametutorials.com (not sure though)...i thought of this method myself after needing a mouse cursor... http://www.opengl.org/discussion_boards/ubb/smile.gif.