Rotate a sprite using drawtexture

Problems with Canvas, OpenGL, etc...

Rotate a sprite using drawtexture

Postby s141797 » Fri Sep 24, 2010 3:31 pm

Hi guys! I´m trying to rotate a sprite using drawtexture but nothing happens- I 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? :)
s141797
Junior Developer
Junior Developer
 
Posts: 13
Joined: Wed Jan 27, 2010 9:43 pm
Location: Norway

Top

Re: Rotate a sprite using drawtexture

Postby mark@project8games.com » Fri Sep 24, 2010 4:34 pm

Draw texture just draws your texture directly to the screen axis aligned. You can't rotate with it. It you need rotation, you have to create your own textured quad.
User avatar
mark@project8games.com
Developer
Developer
 
Posts: 41
Joined: Tue Mar 02, 2010 8:33 pm

Re: Rotate a sprite using drawtexture

Postby s141797 » Sat Sep 25, 2010 12:54 am

Thanks for the reply... Du you by any chance know some goode tutorials on this? I have tried the rotating triangle in the sdk´s ApiDemos, but I didnt quite get it... Or could you maybe post an example here?
s141797
Junior Developer
Junior Developer
 
Posts: 13
Joined: Wed Jan 27, 2010 9:43 pm
Location: Norway

Re: Rotate a sprite using drawtexture

Postby mark@project8games.com » Sat Sep 25, 2010 7:26 am

Check here out http://insanitydesign.com/wp/projects/n ... oid-ports/. Its pretty straight forward to do what you want though.
User avatar
mark@project8games.com
Developer
Developer
 
Posts: 41
Joined: Tue Mar 02, 2010 8:33 pm

Re: Rotate a sprite using drawtexture

Postby s141797 » Sat Sep 25, 2010 10:50 am

Thanks! Thats perfect! :)
s141797
Junior Developer
Junior Developer
 
Posts: 13
Joined: Wed Jan 27, 2010 9:43 pm
Location: Norway

Re: Rotate a sprite using drawtexture

Postby s141797 » Sat Sep 25, 2010 2:57 pm

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.

example code: http://code.google.com/p/apps-for-andro ... MethodTest
s141797
Junior Developer
Junior Developer
 
Posts: 13
Joined: Wed Jan 27, 2010 9:43 pm
Location: Norway

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 1 guest