Undo changes made to the toyball shaders in commit d19d0596daf004b56d80f78fa1a329b43c...
authorBrian <brian.paul@tungstengraphics.com>
Wed, 5 Dec 2007 01:44:40 +0000 (18:44 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Wed, 5 Dec 2007 01:44:40 +0000 (18:44 -0700)
This demo produces the expected results again.

progs/glsl/CH11-toyball.frag.txt
progs/glsl/CH11-toyball.vert.txt

index f3cac62fb3e210877fd7d7edad7a595b7c716d86..90ec1c27fc1824b8ad310df232da1e0eeccd44ae 100644 (file)
@@ -49,15 +49,14 @@ void main()
     inorout += dot(distance, vec4(1.0));
 
     distance.x = dot(p, HalfSpace4);
-//    distance.y = StripeWidth - abs(p.z);
-    distance.y = StripeWidth - abs(p.y);
+    distance.y = StripeWidth - abs(p.z);
     distance = smoothstep(-FWidth, FWidth, distance);
     inorout += distance.x;
 
     inorout = clamp(inorout, 0.0, 1.0);
 
-    surfColor = mix(Yellow, Blue, distance.y);
-    surfColor = mix(surfColor, Red, inorout);
+    surfColor = mix(Yellow, Red, inorout);
+    surfColor = mix(surfColor, Blue, distance.y);
 
     // normal = point on surface for sphere at (0,0,0)
     normal = p;
index a3ee1b03776e375e63551cf5e21b4bc45327f5fe..b7da3ac839ee8d3442abe2e6e2de1bf77eb12a75 100644 (file)
@@ -14,11 +14,10 @@ uniform vec4 BallCenter;   // ball center in modelling coordinates
 
 void main()
 { 
-    ECposition   = gl_ModelViewMatrix * gl_Vertex;
+//orig:    ECposition   = gl_ModelViewMatrix * gl_Vertex;
 
-//  ECposition = gl_TextureMatrix[0] * gl_Vertex;
-//  ECposition = gl_MultiTexCoord0 * gl_Vertex;
-//    ECposition = gl_ModelViewMatrix * ECposition;
+    ECposition = gl_TextureMatrix[0] * gl_Vertex;
+    ECposition = gl_ModelViewMatrix * ECposition;
 
     ECballCenter = gl_ModelViewMatrix * BallCenter;
     gl_Position  = ftransform();