Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

In opengl how do I render 2d sprites in opengl given that I have a png of the sprite? See images as an example of the effect I'd like to achieve. Also I would like to overlay weapons on the screen like the rifle in the bottom image. Does anyone know how I would achieve the two effects? Any help is greatly achieved.

alt text

alt text

share|improve this question
add comment

1 Answer

up vote 12 down vote accepted

What you are looking for is called a billboard or projective sprite. A billboard is basically a quad that always faces the camera. If you don't need it to always face the camera then the code/math will be much simpler.

You can read more about how to implement them here:

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

http://nehe.gamedev.net/data/articles/article.asp?article=19

http://www.flipcode.com/archives/Billboarding-Excerpt_From_iReal-Time_Renderingi_2E.shtml

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.