summaryrefslogtreecommitdiff
path: root/progs/demos/arbfslight.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-02-10 16:44:02 -0700
committerBrian Paul <brianp@vmware.com>2009-02-10 16:44:02 -0700
commit5340b6dff73a0a23531ce2a5f28fba8303adab6e (patch)
treeb141fc3648568dd8b941c966059e6ed32a8bd0ad /progs/demos/arbfslight.c
parent9fd26daec24f21dbe17afcb2e2ab272667ee9a69 (diff)
parentee4c921b65fb76998711f3c40330505cbc49a0e0 (diff)
Merge commit 'origin/gallium-master-merge'
This is the big merge of the gallium-0.2 branch into master. gallium-master-merge was just the staging area for it. Both gallium-0.2 and gallium-master-merge are considered closed now. Conflicts: progs/demos/Makefile src/mesa/main/state.c src/mesa/main/texenvprogram.c
Diffstat (limited to 'progs/demos/arbfslight.c')
-rw-r--r--progs/demos/arbfslight.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/progs/demos/arbfslight.c b/progs/demos/arbfslight.c
index 69575f0623..a84491d34f 100644
--- a/progs/demos/arbfslight.c
+++ b/progs/demos/arbfslight.c
@@ -208,7 +208,31 @@ static void Init (void)
" // Compute dot product of light direction and normal vector\n"
" float dotProd = max (dot (lightPos, normalize (normal)), 0.0);\n"
" // Compute diffuse and specular contributions\n"
+#if 1
" gl_FragColor = diffuse * dotProd + specular * pow (dotProd, 20.0);\n"
+#elif 1 /* test IF/ELSE/ENDIF */
+ " if (normal.y > 0.0) { \n"
+ " gl_FragColor = diffuse * dotProd + specular * pow (dotProd, 20.0);\n"
+ " } \n"
+ " else { \n"
+ " if (normal.x < 0.0) { \n"
+ " gl_FragColor = vec4(1, 0, 0, 0); \n"
+ " } \n"
+ " else { \n"
+ " gl_FragColor = vec4(1, 1, 0, 0); \n"
+ " } \n"
+ " } \n"
+#elif 1 /* test LOOP */
+ " while (1) { \n"
+ " if (normal.y >= 0.0) { \n"
+ " gl_FragColor = vec4(1, 0, 0, 0); \n"
+ " break; \n"
+ " } else { \n"
+ " gl_FragColor = diffuse * dotProd + specular * pow (dotProd, 20.0);\n"
+ " break; \n"
+ " } \n"
+ " } \n"
+#endif
"}\n"
;
static const char *vertShaderText =