Re: [osg-users] GLSL 1.4(1.5) / "in" Storage Qualifier

2010-09-20 Thread John Kush
HOw get vertex coordinates?
Through variable gl_VertexID?

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





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


[osg-users] GLSL 1.4(1.5) / "in" Storage Qualifier

2010-09-20 Thread John Kush
Hi,

How can I pass vertices in GLSL1.4 shaders 
 How can I pass values to "in vec4 vertex"

Code example.

Code:
#version 150

uniform mat4 projectionMatrix; //Specifies that the value is passed to the 
shader from the
application and is constant across a given primitive.
uniform mat4 modelViewMatrix;

in vec4 vertex;//Specifies that the variable is an input to the shader stage.
in vec3 normal;

out vec3 fragmentNormal;
out vec3 fragmentEye;//Specifies that the variable is an output from a shader 
stage.

void main(void)
{
fragmentNormal = (modelViewMatrix*vec4(normal, 0.0)).xyz;

fragmentEye = (modelViewMatrix*vertex).xyz;
fragmentEye = -normalize(fragmentEye);

gl_Position = projectionMatrix*modelViewMatrix*vertex;
}




Thank you!

Cheers,
John

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





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