diff options
Diffstat (limited to 'headtrack_stereo_demo/shaders/greyscale.vert')
-rw-r--r-- | headtrack_stereo_demo/shaders/greyscale.vert | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/headtrack_stereo_demo/shaders/greyscale.vert b/headtrack_stereo_demo/shaders/greyscale.vert index 59c9d80..0eec6f5 100644 --- a/headtrack_stereo_demo/shaders/greyscale.vert +++ b/headtrack_stereo_demo/shaders/greyscale.vert @@ -1,25 +1,19 @@ -varying vec4 diffuse,ambient;
- varying vec3 normal,lightDir,halfVector;
+varying vec4 ambient, diffuse;
+varying vec3 normal, lightdir, halfvector;
+
+void main()
+{
+ //transform the normal
+ normal = gl_NormalMatrix * gl_Normal;
+
+ //determine the light direction
+ lightdir = normalize(gl_LightSource[0].position.xyz);
+ halfvector = normalize(gl_LightSource[0].halfVector.xyz);
- void main()
- {
- /* first transform the normal into eye space and
- normalize the result */
- normal = normalize(gl_NormalMatrix * gl_Normal);
-
- /* now normalize the light's direction. Note that
- according to the OpenGL specification, the light
- is stored in eye space. Also since we're talking about
- a directional light, the position field is actually direction */
- lightDir = normalize(vec3(gl_LightSource[0].position));
+ //compute diffuse and ambient terms
+ diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse;
+ ambient = gl_FrontMaterial.ambient * (gl_LightSource[0].ambient + gl_LightModel.ambient);
- /* Normalize the halfVector to pass it to the fragment shader */
- halfVector = normalize(gl_LightSource[0].halfVector.xyz);
-
- /* Compute the diffuse, ambient and globalAmbient terms */
- diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse;
- ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient;
- ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient;
-
- gl_Position = ftransform();
- }
\ No newline at end of file + gl_Position = ftransform();
+ //gl_TexCoord[0] = gl_MultiTexCoord0;
+}
|