Rotating object by a vector

Hi,

the objects to render are cylinders from (-1,0,0) to (1,0,0) and have a position pos and a direction dir. To render each object I call

foreach object o
{
glPushMatrix
glTranslate(pos)
glRotate(?)
draw cylinder from (-1,0,0) to (1,0,0)
glPopMatrix
}

What are the glRotate calls? I can’t find out how to get some angles and axis out of the dir vector.

Thanks

glRotate (angle, x, y, z) expects angle and rotation vector given by x, y, z and it mutliplies the current transformation matrix by this rotation. If you want to rotate e.g. 50 degrees around y axis, you will call glRotatef (50, 0, 1, 0);

Yes, but I just have the direction vector dir and need an angle and rotation axis for glRotate. Is this the angle between (1,0,0) and dir and the rotation vector the crossproduct of (1,0,0) and dir?

Originally posted by <.:guest:.>:
Yes, but I just have the direction vector dir and need an angle and rotation axis for glRotate. Is this the angle between (1,0,0) and dir and the rotation vector the crossproduct of (1,0,0) and dir?
yes