Hi all,

thank you for your suggestions. 

the original vertex code is :

depthField.vert
-----------------

attribute vec3 Vertex;

uniform mat4 ProjectionMatrix;
uniform mat4 ViewMatrix;
uniform mat4 ModelMatrix;
uniform vec3 ModelScale;

varying vec4 vPosition;


void main ()
{
    vPosition = ViewMatrix * ModelMatrix * vec4(Vertex * ModelScale, 1.0);
    gl_Position = ProjectionMatrix * vPosition;
}

**** end vertex code

I substitute the uniform variables with the following :

attribute vec3 Vertex;

uniform mat4 osg_ProjectionMatrix; 
uniform mat4 osg_ViewMatrix;
uniform mat4 osg_ViewMatrixInverse;  
uniform vec3 ModelScale;

varying vec4 vPosition;


void main ()
{
    mat4 ModelMatrix=osg_ViewMatrixInverse * gl_ModelViewMatrix;   
    vPosition = osg_ViewMatrix * ModelMatrix * vec4(Vertex * ModelScale, 1.0);
    gl_Position = osg_ProjectionMatrix * vPosition;
}

and in my osg application, i  used :

gc->getState()->setUseModelViewAndProjectionUniforms(true);

I didn't get the aspected result.
Do i change also the Vertex attribute and use osg_Vertex?

Where i can find all the osg built-in variables?


Thank you in advance.


Cheers,
Andrea

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to