# Display List Rotations

Hi,

Some of you are probably gonna laugh your faces off at this but I’m new to openl so cut me some slack !
Anyways what I’m trying to do is animate a playing cards motion. The card walks on it’s base vertices put one corner in front of the other. My card is a bezier curve generated into a display list. To move the card I need to rotate it around the ‘foot’ vertex that is not moving (point 0 on diag.)

2|--------|3
| |
| |
| |
| | Y
| | ^
1|--------|0 |-> X

Two rotations must be done, one around Z (to move edge 1 upwards) and the other around Y to rotate the card away or towards the user.

My first problem is isolating the card from the other objets (floor etc…). I’d like to be able to move the viewpoint around while the card moves and the only way of doing this that seems to works is as follows :

``````glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
gluLookAt(0.0,3.0,angle,0.0,0.0,0.0,0.0,1.0,0.0);
glPushMatrix();
glTranslate(-0.75,-0.75,-.5);
glRotatef(angle2,0.0f,0.0f,1.0f);
glCallList(mybezier.dlBPatch);
glPopMatrix();
gluLookAt(0.0,3.0,angle,0.0,0.0,0.0,0.0,1.0,0.0);
glBegin(GL_TRIANGLES);
glVertex3f(1.0,2.0,0.0);
glVertex3f(3.0,-1.0,0.0);
glVertex3f(2.0,-1.0,1.0);
glEnd();
glutSwapBuffers();
``````

This seems clumsey, has anyone got a better suggestion?

The other problem is the actual rotation. If I translate, rotate and then draw as above the object doesn’t rotate about the point specified by the translation. So how do I rotate around the point ?? (in this case point 0)

Thanks
Tony