PDA

View Full Version : Setting the origin of an object in OpenGL



ReAKtor
08-20-2003, 12:13 PM
I'm rendering 3D text to the screen. First I translate into the screen by 6 so the object is visible then rotate it on the Y axis.

The problem is this: When OpenGL draws the 3D text it renders it so that the origin of the object is in the top left corner. When it rotates on the Y axis it rotates around this origin. So...

How do I set the origin to be the centre of the 3D text rather than the top left so that it will rotate on the spot (without moving left or right)?

Translating doesn't work because it moves the object. I don't want to move the object just the coordinate system. Anyone understand this?

BlueJ
08-20-2003, 03:42 PM
To spin an object around its center:

1. translate to center the object in the coordinates system.

2. rotate.

3. translate to position the object where you want it to be.

(edited for clarity)

[This message has been edited by BlueJ (edited 08-20-2003).]