summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2002-11-28 15:51:55 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2002-11-28 15:51:55 +0000
commit1b94df053d9eabf774d7f5c957f96aeedfe29f51 (patch)
treedbc9a135613a08fa00bf0567200a83e2721265af /progs
parent957a0cdb13d2564a17c1fc9f6600d6cd56cb48d7 (diff)
use polygon offset to avoid multi-pass Z-fighting artifacts
Diffstat (limited to 'progs')
-rw-r--r--progs/demos/gloss.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/progs/demos/gloss.c b/progs/demos/gloss.c
index f39d8d1609..9f9703ac6c 100644
--- a/progs/demos/gloss.c
+++ b/progs/demos/gloss.c
@@ -1,4 +1,4 @@
-/* $Id: gloss.c,v 1.6 2000/12/24 22:53:54 pesco Exp $ */
+/* $Id: gloss.c,v 1.7 2002/11/28 15:51:55 brianp Exp $ */
/*
* Specular reflection demo. The specular highlight is modulated by
@@ -85,9 +85,9 @@ static void Display( void )
glCallList(Object);
/* Second pass: specular lighting with reflection texture */
+ glEnable(GL_POLYGON_OFFSET_FILL);
glBlendFunc(GL_ONE, GL_ONE); /* add */
glEnable(GL_BLEND);
- glDepthFunc(GL_LEQUAL);
glMaterialfv(GL_FRONT, GL_DIFFUSE, Black);
glMaterialfv(GL_FRONT, GL_SPECULAR, White);
if (DoSpecTexture) {
@@ -102,6 +102,7 @@ static void Display( void )
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_BLEND);
+ glDisable(GL_POLYGON_OFFSET_FILL);
glPopMatrix();
@@ -341,6 +342,8 @@ static void Init( int argc, char *argv[] )
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
+ glPolygonOffset( -1, -1 );
+
if (argc > 1 && strcmp(argv[1], "-info")==0) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));