Hi,
I have a ortho matrix setup for the projection matrix, with the following values
glOrtho(-100, 100, -100, 100, -1, 1);
Essentially I have a quad which is being rendered which has the coordinates set to the lower left hand corner.
As so:
const GLfloat coords[] =
{
0.0f, 0.0f, // top left
0.0f + size.x, 0.0f, // top right
0.0f + size.x, 0.0f + size.y, // bottom right
0.0f, 0.0f + size.y // bottom left
};
glPushMatrix();
glLoadIdentity();
// set the current colour (white R=G=B=1)
glColor3f(color.x, color.y , color.z);
glTranslatef(location.x, location.y, 0.0f);
glRotatef(rotationDegreesAngle, 0.0f, 0.0f, 1.0f);
glVertexPointer(2, GL_FLOAT, 0, coords);
glEnableClientState(GL_VERTEX_ARRAY);
glDrawArrays(GL_QUADS, 0, 4);
glPopMatrix();
The issue I am having is the glRotatef works correctly, however, it pivots the quad on the corner, not in the centre.
How would I change glRotate to pivot around the centre of the object.
Thanks in advance.