I'm trying to create an application using Direct3D. I have a cylinder in a vertexbuffer (a narrow cylinder, think of it as a line), with the ends at 0,0,0 and 1,0,0. Now, i need to rotate it so that it is rendered with one end at point x1,y1,z1 and the other at point x2,y2,z2 in the world space (the points will move around a lot). I have managed to scale it so that it has the correct length, translate it so it starts at the right point, and even rotate it around the z-axis correctly, but the rotation around the x and y axis wont work.
So, i need to use D3DXMatrixRotationYawPitchRoll(), right? How do i calculate the angles?