Re: [osg-users] Scale problem while transforming object in vertex shader

2017-04-18 Thread Sebastian Messerschmidt


Hi Yura

Hi,

I have a transform matrix and I want to apply it in shader. I pass it into 
uniform and set gl_Position = 
gl_ModelViewProjectionMatrix*my_transfrom_matrix*gl_Vertex.
If I set translate only, everything is ok. If I set translate and scale - 
translate multiplies by scale and transform is wrong (object is too far if 
scale>1.0). If I apply this transform not using shader (by SetMatrix) 
everything is ok. What I am doing wrong?

Matrix multiplication is not cummutative in every case.
Try
gl_Position = gl_ModelViewMatrix * matrix * gl_ProjectionMatrix * 
gl_Vertex.


Cheers
Sebastian



Thank you!

Cheers,
Yura

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70768#70768





___
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


[osg-users] Scale problem while transforming object in vertex shader

2017-04-15 Thread Yura Ivanov
Hi,

I have a transform matrix and I want to apply it in shader. I pass it into 
uniform and set gl_Position = 
gl_ModelViewProjectionMatrix*my_transfrom_matrix*gl_Vertex. 
If I set translate only, everything is ok. If I set translate and scale - 
translate multiplies by scale and transform is wrong (object is too far if 
scale>1.0). If I apply this transform not using shader (by SetMatrix) 
everything is ok. What I am doing wrong?


Thank you!

Cheers,
Yura

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70768#70768





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org