PDA

View Full Version : How do I keep a billboard the same size on screen regardless of the cameras position?



xman84
01-03-2013, 05:42 PM
I recently added a billboard to display a character's name into a game. It looks good except for I would like to keep the name the same size on the screen regardless of how far the camera is from other players. How can I do this?

This is a 3D game being written using OpenGL ES 2.

Any help is appreciated.

cireneikual
01-03-2013, 10:14 PM
You can project the position of the players into window coordinates (using gluProject or custom matrix math) and then render name tags in an orthographic projection. I think you can also set the model-view-projection matrix's values to 1 at indices 0, 5, 10 to remove scaling. I am not sure on that one though.

Carmine
01-04-2013, 11:26 AM
This is a 3D game being written using OpenGL ES 2.
You want your billboard to behave like bitmapped characters, i.e. always facing the camera, never changing size, and following an object as it moves in 3D space. This is exactly what glDrawPixels does in conjunction with glRasterPos. Not sure if glDrawPixels is available to you in OpenGL ES.