views:

1953

answers:

2

I have a sprite loaded as a texture and I need to animate it, allowing it to "face" left or right -- essentially sometimes I need to "flip" it. I know that OpenGL has a gltranslate which repositions an object, and glrotate which rotates it. Is there a method that simply flips it across one axis? If not, how would you accomplish this?

A: 

You can't do this with OpenGL point-sprites; although you can move the center of the sprite around, the shape of it is always oriented the same way.

What you can do is draw your sprites as quads, which lets you flip, rotate and mess with them any way you want. There are tutorials on manually drawing sprites (aka billboards) on NeHe

+3  A: 

I haven't messed around with point sprites, but I believe that they are textures. Textures have texture matrices, which means you can use glTranslatef(), glScalef() and glRotatef() on them. Now, I would go the variant glScalef(-1,1,1); which would flip the texture coordinate by the X axis.

As I said, I haven't played with point sprites, but I didn't mess with texture matrices either. They do seem quite useful, though.

Ivan Vučica