quad won't rotate around center in lwjgl

128 views Asked by At

My code is:

GL11.glPushMatrix();

// rotate around center
GL11.glTranslatef(-200/2, -200/2, 0);      
GL11.glRotatef(30, 0.0f, 0.0f, 1);
GL11.glTranslatef(200/2, 200/2, 0);
// draw quad
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0f,0.5f);
GL11.glVertex3f(50,50,1);
GL11.glTexCoord2f(0.5f,0.5f);
GL11.glVertex3f(50+200,50,1);
GL11.glTexCoord2f(0.5f,0f);
GL11.glVertex3f(50+200,50+200,1);
GL11.glTexCoord2f(0f,0f);
GL11.glVertex3f(50,50+200,1);
GL11.glEnd();

GL11.glPopMatrix();

and it's not rotating it around the center, am I doing this correctly? if not how would I?

0

There are 0 answers