Mesa (master): fp: add some more texture, position and kill tests

Keith Whitwell keithw at kemper.freedesktop.org
Fri Mar 6 21:15:53 UTC 2009


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

Author: Keith Whitwell <keithw at vmware.com>
Date:   Fri Mar  6 21:15:19 2009 +0000

fp: add some more texture, position and kill tests

---

 progs/fp/fp-tri.c        |   20 +++++++++++++++++++-
 progs/fp/tex-pos-kil.txt |    8 ++++++++
 progs/fp/tex-pos.txt     |    6 ++++++
 progs/fp/tex.txt         |    3 +++
 4 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c
index b695901..1598739 100644
--- a/progs/fp/fp-tri.c
+++ b/progs/fp/fp-tri.c
@@ -11,6 +11,11 @@
 #include <GL/glew.h>
 #include <GL/glut.h>
 
+#include "readtex.c"
+
+
+#define TEXTURE_FILE "../images/bw.rgb"
+
 unsigned show_fps = 0;
 unsigned int frame_cnt = 0;
 void alarmhandler(int);
@@ -65,6 +70,7 @@ static void args(int argc, char *argv[])
 
 static void Init( void )
 {
+   GLuint Texture;
    GLint errno;
    GLuint prognum;
    char buf[4096];
@@ -107,7 +113,19 @@ static void Init( void )
    }
    glEnable(GL_FRAGMENT_PROGRAM_ARB);
 
-   glClearColor(.3, .3, .3, 0);
+
+   /* Load texture */
+   glGenTextures(1, &Texture);
+   glBindTexture(GL_TEXTURE_2D, Texture);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+   if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
+      printf("Error: couldn't load texture image file %s\n", TEXTURE_FILE);
+      exit(1);
+   }
+
+   glClearColor(.1, .3, .5, 0);
 }
 
 static void Reshape(int width, int height)
diff --git a/progs/fp/tex-pos-kil.txt b/progs/fp/tex-pos-kil.txt
new file mode 100644
index 0000000..b7aaa9f
--- /dev/null
+++ b/progs/fp/tex-pos-kil.txt
@@ -0,0 +1,8 @@
+!!ARBfp1.0
+TEMP R0;
+MUL R0, fragment.position, {0.008}.x;
+TEX R0, R0, texture[0], 2D;
+SUB R0, R0, {0.25}.x;
+KIL R0.xyzz;
+MOV result.color, fragment.color;
+END
diff --git a/progs/fp/tex-pos.txt b/progs/fp/tex-pos.txt
new file mode 100644
index 0000000..b969f42
--- /dev/null
+++ b/progs/fp/tex-pos.txt
@@ -0,0 +1,6 @@
+!!ARBfp1.0
+TEMP R0;
+MOV R0, {0.0}.x;
+MUL R0.xy, fragment.position, {0.008}.x;
+TEX result.color, R0, texture[0], 2D;
+END
diff --git a/progs/fp/tex.txt b/progs/fp/tex.txt
new file mode 100644
index 0000000..b3a885d
--- /dev/null
+++ b/progs/fp/tex.txt
@@ -0,0 +1,3 @@
+!!ARBfp1.0
+TEX result.color, fragment.color, texture[0], 2D;
+END




More information about the mesa-commit mailing list