Demos (master): pointcoord: use 'o' key to toggle point sprite origin

Brian Paul brianp at kemper.freedesktop.org
Mon Sep 20 21:33:21 UTC 2010


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

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Sep 17 10:41:55 2010 -0600

pointcoord: use 'o' key to toggle point sprite origin

---

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

diff --git a/src/glsl/pointcoord.c b/src/glsl/pointcoord.c
index 5dced6f..00b91f4 100644
--- a/src/glsl/pointcoord.c
+++ b/src/glsl/pointcoord.c
@@ -24,11 +24,17 @@ static GLuint program;
 static GLint win = 0;
 static GLint tex0;
 static GLenum Filter = GL_NEAREST;
+static GLenum Origin = GL_UPPER_LEFT;
 
 
 static void
 Redisplay(void)
 {
+   printf("GL_POINT_SPRITE_COORD_ORIGIN = %s\n",
+          (Origin == GL_UPPER_LEFT ? "GL_UPPER_LEFT" : "GL_LOWER_LEFT"));
+
+   glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, Origin);
+
    glClear(GL_COLOR_BUFFER_BIT);
 
    /* draw one point/sprite */
@@ -76,6 +82,13 @@ Key(unsigned char key, int x, int y)
   (void) y;
 
    switch(key) {
+   case 'o':
+   case 'O':
+      if (Origin == GL_UPPER_LEFT)
+         Origin = GL_LOWER_LEFT;
+      else
+         Origin = GL_UPPER_LEFT;
+      break;
    case 27:
       CleanUp();
       exit(0);




More information about the mesa-commit mailing list