[osg-users] Which matrix decides the world position of the vertex
guilianzhang at 163.com
Tue Jul 1 01:30:37 PDT 2008
This problem has confused me for a long time, I have made a lot of effort to get the matrix which translate the vertex from local coordinate to world space coordinate in osg, however, the result seems that the matirx I get from MatrixTransform does not work in glsl.
Though it seems that I can get the world position of the vertex through osg_ViewMatrixInverse combined with gl_ModelViewMatrix, but I think it is not advisable for there are so much instructions for vertex shader.
I build the indoor scene using osg2.4. Each object added to the scene is added to a MatrixTransform(mt) node which containing all the information of translation,rotation and so on, this MatrixTransform node is then added to the root. I send the matrix(ModelWorld = mt->getMatrix()) to the vertex shader to get the world position of the vertex, but the result of gl_Vertex * ModelWorld in glsl seems not the world position of the vertex.
Any informations about this will be appreciated.
Thanks very much for your help!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the osg-users