Need some help transforming coordinate systems

Hi,

I have a coordinate system in xyz(local) format I want to transform into xzy(my world coordinate system) . Can someone give me the transform please.

Thanks & Regards
Brett,

If you want to swap the y and z coordinate, I think you have to rotate -90 degree around the x axis then scale the y axis by -1. Try that if it works:


//local to world coordinate transformation
glScalef(1.0,-1.0,1.0);
glRotatef(-90.0,1.0,0.0,0.0);
drawYourObject();

Edit: The scale must be aplied to the z axis(third coordinate).

If its a normal I have to do the same ??

If its a normal I have to do the same ??

If you do your transformation via the OpenGL matrix stack, the normal will be transformed automatically for you. But the transformation of vertices is different of the transformation of normals. See this link for more information.

Thank you very much. I am not using opengl matrix stack I am using openscenegraph so I have the multiply my normal with inverse transpose of the the transformation matrix right ? Since, There is non uniform scale going on ???

I have used OpenScenegraph and the normals was transformed automatically with fixed function pipeline (no use of shaders).