Mesa (master): trivial: Make tri-fog a bit more interesting to look at

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Wed Feb 18 13:27:58 UTC 2009


Module: Mesa
Branch: master
Commit: b6779056a108675b04ec8b57d7f84b5582f3144f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b6779056a108675b04ec8b57d7f84b5582f3144f

Author: Jakob Bornecrantz <jakob at vmware.com>
Date:   Fri Feb 13 23:03:57 2009 +0100

trivial: Make tri-fog a bit more interesting to look at

---

 progs/trivial/tri-fog.c |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/progs/trivial/tri-fog.c b/progs/trivial/tri-fog.c
index 75f3262..a2e12f8 100644
--- a/progs/trivial/tri-fog.c
+++ b/progs/trivial/tri-fog.c
@@ -42,6 +42,15 @@ static void Init(void)
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
+
+    glEnable(GL_FOG);
+    glFogi(GL_FOG_MODE, GL_LINEAR);
+    glFogf(GL_FOG_START, 25);
+    glFogf(GL_FOG_END, 35);
+#if 0
+    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+    glEnable (GL_BLEND);
+#endif
 }
 
 static void Reshape(int width, int height)
@@ -70,26 +79,26 @@ static void Key(unsigned char key, int x, int y)
 
 static void Draw(void)
 {
-   glClear(GL_COLOR_BUFFER_BIT); 
+   glClear(GL_COLOR_BUFFER_BIT);
 
    glEnable(GL_FOG);
 
    glBegin(GL_TRIANGLES);
-   glColor3f(0,0,.7); 
+   glColor3f(1,1,1);
    glVertex3f( 0.9, -0.9, -30.0);
-   glColor3f(.8,0,0); 
+   glColor3f(1,1,1);
    glVertex3f( 0.9,  0.9, -30.0);
-   glColor3f(0,.9,0); 
-   glVertex3f(-0.9,  0.0, -30.0);
+   glColor3f(1,1,1);
+   glVertex3f(-0.9,  0.0, -40.0);
    glEnd();
 
 #if 0
    glBegin(GL_TRIANGLES);
-   glColor3f(0,0,.7); 
+   glColor3f(0,0,.7);
    glVertex3f(-0.9, -0.9, -30.0);
-   glColor3f(.8,0,0); 
+   glColor3f(.8,0,0);
    glVertex3f(-0.9,  0.9, -30.0);
-   glColor3f(0,.9,0); 
+   glColor3f(0,.9,0);
    glVertex3f( 0.9,  0.0, -30.0);
    glEnd();
 #endif




More information about the mesa-commit mailing list