Hi Guilanzhang,

Could it be that you have been confused by the pre-multiple convention
of OSG maths, and post-multiple convention of GLSL maths, the opposing
conventions has turned out to be rather unfortunate, the OSG's
convention fitted we will other tools in it's early days, but alas
GLSL came along later and cemented the opposite convention.   So in
OSG land you have:

  v' = v * M

In GLSL

 v' = M * v

I would ideally like to wave a magic wand and have all the OSG and
user code moved across to the GLSL convention, but alas doing this in
practice would break lots of code.

Robert.

On Tue, Jul 1, 2008 at 9:30 AM, guilianzhang <[EMAIL PROTECTED]> wrote:
> Hi,
> 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!
> ________________________________
> guilianzhang
> 2008-07-01
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to