There are many ways to rotate a coordinate frame to a point in a given direction; they all leave the z axis directed in the direction you need, but with variations in the orientation of the x and y landmarks.
The following is a brief rotation, which may or may not be what you want.
vec3 target_dir = normalise( vector ); float rot_angle = acos( dot_product(target_dir,z_axis) ); if( fabs(rot_angle) > a_very_small_number ) { vec3 rot_axis = normalise( cross_product(target_dir,z_axis) ); glRotatef( rot_angle, rot_axis.x, rot_axis.y, rot_axis.z ); }
Mike f
source share