Alas, that had no effect. I have _something_ sort of working
surface.glMatrixMode(GL10.GL_MODELVIEW);
surface.glEnable(GL10.GL_TEXTURE_2D);
surface.glBindTexture(GL10.GL_TEXTURE_2D, ids[index]);
Grid.beginDrawing(surface, true, false);
surface.glPushMatrix();
// Draw using the DrawTexture extension.
int drawHeight = texture.getDrawHeight();
int drawWidth = texture.getDrawWidth();
float ypos = screenHeight - drawHeight- y;
surface.glLoadIdentity();
surface.glTranslatef(x, ypos, 0);
surface.glRotatef(-angle, 0.0f, 0.0f, 1.0f);
surface.glTranslatef(-x, -ypos, 0); // THIS NOT DOING WHAT
I THOUGHT WOULD
texture.getGrid().draw(surface, true, false);
surface.glPopMatrix();
Grid.endDrawing(surface);
surface.glDisable(GL10.GL_TEXTURE_2D);
What I can't seem to get working now it the re-translate back to the
original point after the rotation.
On Oct 12, 6:02 am, Kunal Kant <[email protected]> wrote:
> remove that line " surface.glLoadIdentity();"
> i think it will rotate
>
> On Sun, Oct 10, 2010 at 10:46 PM, Alistair.
> <[email protected]>wrote:
>
>
>
>
>
>
>
> > I am trying to rotate a bitmap in OpenGL. I have searched around and
> > come up with this
>
> > public void drawTexture(Texture texture, int index, float x, float
> > y, float angle)
> > {
> > int[] ids = texture.getTextureIds();
>
> > if (ids != null)
> > {
> > surface.glEnable(GL10.GL_TEXTURE_2D);
>
> > surface.glBindTexture(GL10.GL_TEXTURE_2D, ids[index]);
>
> > // Draw using the DrawTexture extension.
> > int drawWidth = texture.getDrawWidth();
> > int drawHeight = texture.getDrawHeight();
>
> > surface.glPushMatrix();
>
> > surface.glLoadIdentity();
>
> > surface.glRotatef(angle, 0.0f, 0.0f, 1.0f);
>
> > ((GL11Ext) surface).glDrawTexfOES(x, screenHeight -
> > drawHeight - y, 0, drawWidth, drawHeight);
>
> > surface.glPopMatrix();
>
> > surface.glDisable(GL10.GL_TEXTURE_2D);
>
> > }
> > }
>
> > Drawing the bitmaps indicated with the "ids" works fine but no
> > rotation happens. I am no expert at openGL. Is is possible I need to
> > set some sort of mode prior to the rotation?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-developers%2Bunsubs
> > [email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en