Demos (master): shadow_sampler: probe/print pixel value, fix GL version check

Brian Paul brianp at kemper.freedesktop.org
Tue Dec 14 01:04:20 UTC 2010


Module: Demos
Branch: master
Commit: efcecb2465183d34924fb4539f2fa17c5cb7eb7a
URL:    http://cgit.freedesktop.org/mesa/demos/commit/?id=efcecb2465183d34924fb4539f2fa17c5cb7eb7a

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Dec 13 18:03:55 2010 -0700

shadow_sampler: probe/print pixel value, fix GL version check

---

 src/glsl/shadow_sampler.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/glsl/shadow_sampler.c b/src/glsl/shadow_sampler.c
index 0adc9d8..f759c06 100644
--- a/src/glsl/shadow_sampler.c
+++ b/src/glsl/shadow_sampler.c
@@ -88,6 +88,18 @@ Redisplay(void)
    glWindowPos2iARB(80, 20);
    PrintString("white   black   white   black");
 
+   {
+      GLfloat pix[4];
+      glReadPixels(120, 150, 1, 1, GL_RGBA, GL_FLOAT, pix);
+      printf("Pixel(120, 150): %f %f %f %f\n", pix[0], pix[1], pix[2], pix[3]);
+      glReadPixels(180, 150, 1, 1, GL_RGBA, GL_FLOAT, pix);
+      printf("Pixel(180, 150): %f %f %f %f\n", pix[0], pix[1], pix[2], pix[3]);
+      glReadPixels(220, 150, 1, 1, GL_RGBA, GL_FLOAT, pix);
+      printf("Pixel(220, 150): %f %f %f %f\n", pix[0], pix[1], pix[2], pix[3]);
+      glReadPixels(280, 150, 1, 1, GL_RGBA, GL_FLOAT, pix);
+      printf("Pixel(280, 150): %f %f %f %f\n", pix[0], pix[1], pix[2], pix[3]);
+   }
+
    glutSwapBuffers();
 }
 
@@ -258,7 +270,7 @@ Init(void)
 #endif
 
    version = (const char *) glGetString(GL_VERSION);
-   if (version[0] != '2' || version[1] != '.') {
+   if (version[0] * 10 + version[2] <= 20) {
       printf("This program requires OpenGL 2.x, found %s\n", version);
       exit(1);
    }




More information about the mesa-commit mailing list