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

therealremi

02-12-2007, 12:33 PM

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.

Rotate first then move to the local coordinate ?

therealremi

02-12-2007, 01: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?

Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.