---
tests/texturing/rg-draw-pixels.c | 96 ++++++++++++++++++++++++++++++++++++++
1 files changed, 96 insertions(+), 0 deletions(-)
create mode 100755 tests/texturing/rg-draw-pixels.c
diff --git a/tests/texturing/rg-draw-pixels.c b/tests/texturing/rg-draw-pixels.c
new file mode 100755
index 0000000..5605d3b
--- /dev/null
+++ b/tests/texturing/rg-draw-pixels.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright © 2009 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Ben Holmes <[email protected]>
+ */
+
+/*
+ * This test draws to the screen using glDrawPixels with data formats of GL_RED
+ * and GL_RG and tests for the correct color output.
+ */
+
+#include "piglit-util.h"
+
+int piglit_width = 40, piglit_height = 30;
+int pilgit_window_mode = GLUT_RGB | GLUT_DOUBLE;
+
+static GLuint tex[2];
+
+void
+piglit_init(int argc, char **argv)
+{
+
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+
+ glEnable(GL_TEXTURE_2D);
+ glClearColor(0.2, 0.2, 0.2, 1.0);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ int height = 16;
+ int width = 16;
+ int i, j;
+
+ GLfloat texData[width][height][4];
+ for (i=0; i < width; ++i) {
+ for (j=0; j < height; ++j) {
+ if ((i+j) & 1) {
+ texData[i][j][0] = 1.0;
+ texData[i][j][1] = 1.0;
+ texData[i][j][2] = 1.0;
+ texData[i][j][3] = 1.0;
+ }
+ else {
+ texData[i][j][0] = 0.0;
+ texData[i][j][1] = 0.0;
+ texData[i][j][2] = 0.0;
+ texData[i][j][3] = 0.0;
+ }
+ }
+ }
+
+ glRasterPos2i(0,0);
+ glDrawPixels(width,height,GL_RED,GL_FLOAT,texData);
+
+ glRasterPos2i(18,0);
+ glDrawPixels(width,height,GL_RG,GL_FLOAT,texData);
+
+ GLboolean pass = GL_TRUE;
+ GLfloat red[3] = {1.0, 0.0, 0.0};
+ GLfloat rg[3] = {1.0, 1.0, 0.0};
+ GLfloat black[3] = {0.0, 0.0, 0.0};
+
+ pass = pass && piglit_probe_pixel_rgb(15,0,red);
+ pass = pass && piglit_probe_pixel_rgb(0,0,black);
+ pass = pass && piglit_probe_pixel_rgb(18,0,rg);
+ pass = pass && piglit_probe_pixel_rgb(23,0,black);
+
+ glFinish();
+ glutSwapBuffers();
+
+ return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
+}
--
1.6.5.2
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev