View Full Version : how to rotate object in local coordinate space?

02-12-2007, 11:33 AM
I have a 3x3 rotation matrix which I would like to use in a Cg vertex shader to rotate vertices. But how to perform the rotation in a shader in local coordinate space (assuming I know the local coordinate matrix)? I have no idea where to start.

02-12-2007, 11:44 AM
Rotate first then move to the local coordinate ?

02-12-2007, 12:14 PM
I'll need more explanation cause I'm a beginner in both 3d math and opengl;)
I specify vertex postitions in world coordinates. I pass the rotation matrix to vertex shader and multiply it with vertex positions - but the rotation happens relative to world coordinate system. Assuming I have matrix L containing local coordinate matrix for an object, how should I integrate this matrix into the computation of rotation? Should I do it in shader or OpenGL? Maybe some piece of code?