sprites? omniditertional?

Please help!

I don’t know how to render a simple Sprite. It is needed for flares and other objects who looks identical from every side.

Is there a simple openGL function or must I write my own?

You render a simple quad with the texture of your sprite on it. But you have to render it in 2D screen coordinates so it always faces you with its front side.

I tried this:





but no sprite! Only a 3D quad. What is wrong?

I’m guessing you haven’t set up your projection matrix for ortho proj. If you don’t do this then your quad will appear with perspective.


So, you see something, but not the texture.
Usual arrays of questions you should ask yourself:

  • texturing enabled?
  • texture downloaded correctly? All levels of detail for mipmapping, which is default?
  • texture environment and texture parameter set correctly? (No mipmapping, if you downloaded level of deatail 0 only).

Texture coordinates s and t normally go from 0.0 to 1.0. You issued coordinates from -1.0 to 1.0. This would display your texture four times on your quad with wrap mode GL_REPEAT.

Look at glAlphaFunc for alpha testing to get the shape of your actual sprite (if it is not a quad).

But I want to display the sprite on a 3D position. With your method I draw a 2D quad on a 2D pos.
I can’t use it for 3D flares.

Search for a tutorial on billboarding. (Look in the GLUT distribution, there is an example.)

What about this one http://reality.sgi.com/mjk/tips/lensflare/