summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2009-03-09 14:08:35 +0000
committerKeith Whitwell <keithw@vmware.com>2009-03-09 14:08:52 +0000
commitfb8a9875f6af28964a56e8307dd90a0b5fe97a4b (patch)
tree11abfb0b8b2889656e9bb6f6f1c3ec71b2b513c6
parent317687cd94d510ed72e32b0aee2782fbc123576b (diff)
fp: enable a second texture unit and add a kil test for it
-rw-r--r--progs/fp/fp-tri.c51
-rw-r--r--progs/fp/tex-pos-kil-1.txt7
2 files changed, 58 insertions, 0 deletions
diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c
index 1598739c57..bc490c0520 100644
--- a/progs/fp/fp-tri.c
+++ b/progs/fp/fp-tri.c
@@ -125,6 +125,57 @@ static void Init( void )
exit(1);
}
+
+ glGenTextures(1, &Texture);
+ glActiveTextureARB(GL_TEXTURE0_ARB + 1);
+ glBindTexture(GL_TEXTURE_2D, Texture);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ {
+ GLubyte data[32][32];
+ int width = 32;
+ int height = 32;
+ int i;
+ int j;
+
+ for (i = 0; i < 32; i++)
+ for (j = 0; j < 32; j++)
+ {
+ /**
+ ** +-----------+
+ ** | W |
+ ** | +-----+ |
+ ** | | | |
+ ** | | B | |
+ ** | | | |
+ ** | +-----+ |
+ ** | |
+ ** +-----------+
+ **/
+ int i2 = i - height / 2;
+ int j2 = j - width / 2;
+ int h8 = height / 8;
+ int w8 = width / 8;
+ if ( -h8 <= i2 && i2 <= h8 && -w8 <= j2 && j2 <= w8 ) {
+ data[i][j] = 0x00;
+ } else if ( -2 * h8 <= i2 && i2 <= 2 * h8 && -2 * w8 <= j2 && j2 <= 2 * w8 ) {
+ data[i][j] = 0x55;
+ } else if ( -3 * h8 <= i2 && i2 <= 3 * h8 && -3 * w8 <= j2 && j2 <= 3 * w8 ) {
+ data[i][j] = 0xaa;
+ } else {
+ data[i][j] = 0xff;
+ }
+ }
+
+ glTexImage2D( GL_TEXTURE_2D, 0,
+ GL_ALPHA8,
+ 32, 32, 0,
+ GL_ALPHA, GL_UNSIGNED_BYTE, data );
+ }
+
+
glClearColor(.1, .3, .5, 0);
}
diff --git a/progs/fp/tex-pos-kil-1.txt b/progs/fp/tex-pos-kil-1.txt
new file mode 100644
index 0000000000..3f01e79ffe
--- /dev/null
+++ b/progs/fp/tex-pos-kil-1.txt
@@ -0,0 +1,7 @@
+!!ARBfp1.0
+TEMP R0;
+MUL R0, fragment.position, {0.03125}.x;
+TEX R0, R0, texture[1], 2D;
+KIL -R0;
+MOV result.color, fragment.color;
+END