summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-02-17 22:00:45 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-02-17 22:00:45 +0000
commit4e41eb1061834c9ed1c0702efdb887197043dc55 (patch)
tree52040341cd8c81fe8ec7c0370145ca175d789599 /progs
parent09da0b8e6621a831e3eeb9381430f2bed18a22ad (diff)
compute fog coord in eye space, not clip space
Diffstat (limited to 'progs')
-rw-r--r--progs/demos/arbfplight.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/progs/demos/arbfplight.c b/progs/demos/arbfplight.c
index 369da2ab52..14d7d3ec10 100644
--- a/progs/demos/arbfplight.c
+++ b/progs/demos/arbfplight.c
@@ -102,6 +102,7 @@ static void Key( unsigned char key, int x, int y )
(void) y;
switch (key) {
case ' ':
+ case 'a':
Anim = !Anim;
if (Anim)
glutIdleFunc(Idle);
@@ -224,6 +225,7 @@ static void Init( void )
"!!ARBvp1.0\n"
"ATTRIB pos = vertex.position; \n"
"ATTRIB norm = vertex.normal; \n"
+ "PARAM modelview[4] = { state.matrix.modelview }; \n"
"PARAM modelviewProj[4] = { state.matrix.mvp }; \n"
"PARAM invModelview[4] = { state.matrix.modelview.invtrans }; \n"
@@ -240,8 +242,8 @@ static void Init( void )
"DP3 result.texcoord[0].w, norm, invModelview[3]; \n"
#if DO_FRAGMENT_FOG
- "# compute fog coordinate\n"
- "DP4 result.fogcoord, pos, modelviewProj[2]; \n"
+ "# compute fog coordinate = vertex eye-space Z coord (negated)\n"
+ "DP4 result.fogcoord, -pos, modelview[2]; \n"
#endif
"END\n";
;
@@ -360,7 +362,7 @@ static void Init( void )
glFogi(GL_FOG_MODE, GL_LINEAR);
glFogfv(GL_FOG_COLOR, fogColor);
glFogf(GL_FOG_START, 5.0);
- glFogf(GL_FOG_END, 10.0);
+ glFogf(GL_FOG_END, 25.0);
glEnable(GL_FOG);
}
#endif