rotation origin

Is there a way to set the origin point for a rotation.

I have an object I am rotating and it is only on the screen for angles between 300 and 320 degree rotations.

I have tried transforming the object after the rotation but the numbers I am inputting are just guessed so I still dont have any control over where the object will appear.

Ideally I would like to set the origin point as the bottomleft of my graphic and have it revolve around that.

the code I have tried out is

glRotated(90, 0, 0, 1);

I have also inserted the line glTranslated(); with values for the x and y.

My results so far have been either off screen
On a part of the screen that I dont want them to be on. Or the rest of my scene has rotated and the object I am trying to rotate has remained in the same place.

I have looked through other posts and tried various things but am still having no luck.

Can anybody help me with this?


You can translate the object before rotating it, note openGL work’s backwards, last transform first.

glTranslate(…) // Move object
glRotate(…) // Rotate on axis
glTranslate(…); // With this translate we can move the rotation axis.

Still not having any luck I tired

void rot(void)



My object is not appearing on the screen.

Can anyone point out where I am going wrong?

Object start point on screen is
void redcar(void)
//set colour red
glColor3f(1.0f, 0.0f, 0.0f);

//car body
glRecti(111.25, 395, 141.25, 455);

//set colour black
glColor3f(0.0f, 0.0f, 0.0f);

//rectangle back of car
glRecti(121.25,435, 131.25,445);

glRecti(141.25,395, 156.25,410);	//bottom right
glRecti(141.25,440, 156.25,455);	//top right
glRecti(96.25,395, 111.25,410);		//bottom left
glRecti(96.25,440, 111.25,455);		//top left

//lines back of car
glVertex2i(123.25, 400);
glVertex2i(123.25, 415);
glVertex2i(126.25, 400);
glVertex2i(126.25, 415);
glVertex2i(129.25, 400);
glVertex2i(129.25, 415);