I am trying to rotate an object about one of its side and already tried the common approach as found on the forums:
translate(-P); rotate(); translate(P); In OpenGL (reversing the order of translations/rotations), I used the following code:
glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glPushMatrix(); glTranslatef(-50, 50, 0); glRotatef(rotationCoord, 0, 1, 0); glTranslatef(50, -50, 0); glBegin(GL_QUADS); glVertex3f(-50.0, 50.0, 0); glVertex3f(50.0, 50.0, 0); glVertex3f(50.0, -50.0, 0); glVertex3f(-50.0, -50.0, 0); glEnd(); glPopMatrix(); However, the rectangle that I am drawing doesn't seem to be rotating around one side as pivot. (trying to set the left side as the pivot point and rotate around it). I made a screen capture vid to show what kind of rotation I am getting right now. Here's the video:
How do I set the pivot for this object so that it rotated around that point?
glRotatef(…, 0, 1, 0)is a rotation around the y-axis (aka xz-plane), not the x-axis.