PDA

View Full Version : What is included?:



Running_Wolf
12-26-2004, 04:31 PM
What variables are simply included in GLSL? Like the view vector, or do I need to pass that information as a uniform?

V-man
12-27-2004, 12:24 PM
You can download the GLSL language document from 3dlabs site. It explains the buit in variables.

There is no built in view vector. If you view vector will change from object to object, then you can use a uniform.

The view vector is either taken as {0, 0, 1}
The eye is infinitly far away at +z.
in this case



const vec3 viewVector = vec3(0.0, 0.0, 1.0);Or from {0, 0, 0} to vertex. The eye is at {0, 0, 0}.


const vec3 eyePos = vec3(0.0, 0.0, 0.0);

void main()
{
vec3 viewVector = normalize(eyePos- vec3(gl_Vertex));

}