rotating a flat plane

how do i go about rotating a flat plane???
all my rotation turns out weird …
please help …

Originally posted by mochi:
how do i go about rotating a flat plane???
all my rotation turns out weird …
please help …

You did not say rotating about what direction.Use something like:

glRotatef(degrees, dx, dy, dz);

Please post some code if you can.

ok…do you translate also?

becaz. you have to rotate first then translate.


glRotate(AxisY, 0.0, 1.0, 0.0);
glTranslate(0.0, 0.0, 1.0);

Otherwise GL moves object like so:

Object A------> Place C

then rotate

       /> Place C (unwanted rotation)

Object A /

I dont know if this helps, maybe I just didnt understand the Q


What if I want to have a plane through the coordinate (0, 0, 1), rotated a degrees around the y-axis? Using your code I would have to calculate the components of the translation.

But translation before rotation does exactly what I want. So I think it’s the other way around, like this:

glTranslatef(0.0, 0.0, 1.0);
glRotatef(angle, 0.0, 1.0, 0.0);


[This message has been edited by Ritchie (edited 09-11-2001).]

in opengl you have to read the transformation commands from the end to the
beginning…an example:

you enter:

  1. glLoadIdentity()
  2. glRotatef(…)
  3. glScalef(…)
  4. glTranslatef(…)

you get:

  1. Translation
  2. Scale
  3. Rotation
  4. Step 1-4 will be combined with the
    identity matrix

This is important to know, otherwise you’ll have troubles with transformations…


Correct me if I’m wrong, but this is what I thought:

The suggested method works perfectly if one wants to draw planets around a moon, or the bolts to a wheel, or even a robot arm. In this method all rotation takes place around one point of origin (In the case of the robot arm there are more points to rotate about, eg shoulder, elbow, wrist etc.). If this is what you are looking for, that is fine.

What I meant was to use one fixed coordinate system for reference. All geometry to be drawn has its coordinates in this system, so first a translation is needed to these coordinates. A set of rotations on the objects coordinate system (which is local) will give the object the desired orientation.