progs/glsl: change samplers.c to better test sampler/texture indexing
authorBrian Paul <brianp@vmware.com>
Wed, 26 Aug 2009 17:53:25 +0000 (11:53 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 26 Aug 2009 17:53:25 +0000 (11:53 -0600)
Now the left half is yellow and the right half is red, with the gradients
going in opposite directions.

progs/glsl/samplers.c

index 113e5bbeff14d5471a78b5bcaaf363e32ac93528..87dad5d85752daaeab1632fe2d96aa813bd3dbbf 100644 (file)
@@ -211,10 +211,18 @@ InitTextures(void)
       for (y = 0; y < stripeSize; y++) {
          for (x = 0; x < size; x++) {
             GLint k = 4 * ((ypos + y) * size + x);
-            texImage[k + 0] = intensity;
-            texImage[k + 1] = intensity;
-            texImage[k + 2] = 0;
-            texImage[k + 3] = 255;
+            if (x < size / 2) {
+               texImage[k + 0] = intensity;
+               texImage[k + 1] = intensity;
+               texImage[k + 2] = 0;
+               texImage[k + 3] = 255;
+            }
+            else {
+               texImage[k + 0] = 255 - intensity;
+               texImage[k + 1] = 0;
+               texImage[k + 2] = 0;
+               texImage[k + 3] = 255;
+            }
          }
       }