Suppose I have a world defined in typical OpenGL coords.. then the up vector defined for this space is (0,1,0).

Now, if I load a model that is defined with (0,0,1) as its up vector, what are the matrix operation(s) that I need to carry out here to arrive at the 4x4 transformation matrix for the model?

Many thanks.


The up vector being different basically means that the model is in a different space, where Z inwards represents that what you regard as Y up. To compensate for this, rotate the model vertices 90 degrees over the X-axis (in the right direction). Draw the axes on paper, it'll be clear in a jiffy.

Think of it as this: if you were to rotate the up vector 0, 0, 1 -- how would you do it to make it 0, 1, 0?

Use Google for all about building rotation matrices. Or use glRotate() for a quick test.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.