diff mbox

[Branch,~glmark2-dev/glmark2/trunk] Rev 12: Fix errors in shaders.

Message ID 20110721123630.17019.40508.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

Alexandros Frantzis July 21, 2011, 12:36 p.m. UTC
------------------------------------------------------------
revno: 12
committer: Alexandros Frantzis <alf82@freemail.gr>
timestamp: Thu 2010-07-08 12:08:36 +0300
message:
  Fix errors in shaders.
modified:
  data/shaders/light-advanced.frag
  data/shaders/light-basic.vert


--
lp:glmark2
https://code.launchpad.net/~glmark2-dev/glmark2/trunk

You are subscribed to branch lp:glmark2.
To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'data/shaders/light-advanced.frag'
--- data/shaders/light-advanced.frag	2010-07-07 10:32:18 +0000
+++ data/shaders/light-advanced.frag	2010-07-08 09:08:36 +0000
@@ -81,14 +81,14 @@ 
 
 void main(void)
 {	
-	Normal = normalize(Normal);
-
-	float Diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse * max(dot(Normal, Light),0.0);
-
-	float Ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient;
+	vec3 N = normalize(Normal);
+
+	vec4 Diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse * max(dot(N, Light),0.0);
+
+	vec4 Ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient;
 	Ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient;
 
-	float Specular = gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(max(dot(Normal,HalfVector),0.0), gl_FrontMaterial.shininess);
+	vec4 Specular = gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(max(dot(Normal,HalfVector),0.0), gl_FrontMaterial.shininess);
 
-	gl_FragColor = Ambient + (Diffuse * vec4(1,0,0,1)) + Specular;
+	gl_FragColor = Ambient + (Diffuse * vec4(0,0,1,1)) + Specular;
 }

=== modified file 'data/shaders/light-basic.vert'
--- data/shaders/light-basic.vert	2010-07-07 10:32:18 +0000
+++ data/shaders/light-basic.vert	2010-07-08 09:08:36 +0000
@@ -62,11 +62,11 @@ 
 
 void main(void)
 {			
-	Normal = normalize(gl_NormalMatrix * gl_Normal);
+	vec3 Normal = normalize(gl_NormalMatrix * gl_Normal);
 
-	Light = normalize(gl_LightSource[0].position.xyz);
+	vec3 Light = normalize(gl_LightSource[0].position.xyz);
 
 	Diffuse = max(dot(Normal, Light),0.0);
 
 	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
-}
\ No newline at end of file
+}