---
 tests/bugs/point-sprite.c |   54 ++++++++++++++++++--------------------------
 1 files changed, 22 insertions(+), 32 deletions(-)

diff --git a/tests/bugs/point-sprite.c b/tests/bugs/point-sprite.c
index cf96ca3..174aa8a 100644
--- a/tests/bugs/point-sprite.c
+++ b/tests/bugs/point-sprite.c
@@ -23,6 +23,10 @@
 
 // author: Ben Holmes
 
+/*
+ * This test draws a point sprite with a checkerboard texture and tests whether
+ * the correct colors were drawn using piglit_probe_pixel_rgb.
+ */
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -40,15 +44,12 @@ static GLboolean Automatic = GL_FALSE;
 static float maxSize = 0.0f;
 static GLuint tex;
 
-
-extern void *glutGetProcAddress(const GLubyte *);
-
-
 static void
 Init()
 {
 
        glewInit();
+       piglit_require_extension("GL_ARB_point_sprite");
        glMatrixMode(GL_PROJECTION);
         glPushMatrix();
         glLoadIdentity();
@@ -78,8 +79,10 @@ display()
        glClear(GL_COLOR_BUFFER_BIT);
        glBindTexture(GL_TEXTURE_2D, tex);
 
-       //opengl version must be at least 2.0 to support
-        //modifying GL_POINT_SPRITE_COORD_ORIGIN
+       /*
+        *opengl version must be at least 2.0 to support
+         *modifying GL_POINT_SPRITE_COORD_ORIGIN
+        */
        if (GLEW_VERSION_2_0)
                glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_UPPER_LEFT);
 
@@ -88,16 +91,13 @@ display()
        glEnd();
 
        GLfloat black[3] = {0.0, 0.0, 0.0};
-       GLboolean pass = piglit_probe_pixel_rgb(200, 120, black);
-
-       glFinish();
-       glutSwapBuffers();
-       
-
-       glClear(GL_COLOR_BUFFER_BIT);
+       GLboolean pass;
+       pass  = piglit_probe_pixel_rgb(200, 120, black);
 
-       //opengl version must be at least 2.0 to support 
-       //modifying GL_POINT_SPRITE_COORD_ORIGIN
+       /*
+        *opengl version must be at least 2.0 to support 
+        *modifying GL_POINT_SPRITE_COORD_ORIGIN
+        */
        if (GLEW_VERSION_2_0) {
                glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_LOWER_LEFT);
        
@@ -107,14 +107,17 @@ display()
 
                GLfloat white[3] = {1.0, 1.0, 1.0};
                pass = pass && piglit_probe_pixel_rgb(200, 120, white);
-
-               glFinish();
-               glutSwapBuffers();
        }
 
+
        if(Automatic)
                piglit_report_result(pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE);
 
+       glFinish();
+       glutSwapBuffers();
+
+       glClear(GL_COLOR_BUFFER_BIT);
+
 }
 
 
@@ -159,19 +162,6 @@ loadTex()
 
 }
 
-static void Key(unsigned char key, int x, int y)
-{
-        (void) x;
-        (void) y;
-        switch (key) {
-        case 27:
-                exit(0);
-                break;
-        }
-        glutPostRedisplay();
-}
-
-
 int main(int argc, char **argv)
 {
        glutInit(&argc, argv);
@@ -181,7 +171,7 @@ int main(int argc, char **argv)
        glutInitWindowSize(400, 300);
        glutCreateWindow("point_sprite");
        glutDisplayFunc(display);
-       glutKeyboardFunc(Key);
+       glutKeyboardFunc(piglit_escape_exit_key);
 
        Init();
 
-- 
1.6.3.3


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to