views:

93

answers:

2

Hi guys! I´m trying to rotate a sprite using drawtexture but nothing happens. I´m using the following code:

gl.glRotatef(90, 0, 0, 1.0f); gl.glBindTexture(GL10.GL_TEXTURE_2D, TextureID); (GL11Ext) gl).glDrawTexfOES(x, y, z, width, height);

The texture is drawn to the screen but it is not rotated... Anyone? :)

+2  A: 

From the OES_draw_texture extension:

Xs and Ys are given directly in window (viewport) coordinates.

So the passed in coordinates are not transformed by the modelview and projection matrices, which is what glRotatef changes. In short, this extension does not support rotated sprites.

If you want those, the simplest is to draw standard rotated quads instead.

Bahbar
Thanks! Do you know any good tutorials on doing this? Havent had any luck finding any...
A: 

After testing quite a bit og different ways to do this, I found the answer was right in front of me the whole time... I was using the SpriteMethodTest example as my codebase, but I ignored the VBO extension part there, wich basically has all the needed functionality.

SpriteMethodTest: http://code.google.com/p/apps-for-android/source/browse/trunk/#trunk/SpriteMethodTest