Add a negative test for bitwise not used in a larger expression.
[piglit/hramrach.git] / tests / general / scissor-clear.c
blob9d53aebeb7130de239a921eaa25f5b41c6ce1fc8
1 /*
2 * Copyright © 2009 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
23 * Authors:
24 * Eric Anholt <eric@anholt.net>
28 /** @file scissor-clear.c
30 * Tests that glScissor properly affects glClear(GL_COLOR_BUFFER_BIT)().
33 #include "piglit-util.h"
35 int piglit_width = 100, piglit_height = 100;
36 int piglit_window_mode = GLUT_DOUBLE | GLUT_RGB;
38 enum piglit_result
39 piglit_display(void)
41 GLboolean pass = GL_TRUE;
42 int x, y;
43 static float green[] = {0.0, 1.0, 0.0, 0.0};
44 static float blue[] = {0.0, 0.0, 1.0, 0.0};
46 /* whole window green. */
47 glClearColor(0.0, 1.0, 0.0, 0.0);
48 glClear(GL_COLOR_BUFFER_BIT);
50 /* Clear depth quad at 10, 10 to be drawn blue. */
51 glEnable(GL_SCISSOR_TEST);
52 glScissor(10, 10, 10, 10);
53 glClearColor(0.0, 0.0, 1.0, 0.0);
54 glClear(GL_COLOR_BUFFER_BIT);
56 for (y = 0; y < piglit_height; y++) {
57 for (x = 0; x < piglit_width; x++) {
58 float *expected;
60 if (x >= 10 && x < 20 && y >= 10 && y < 20)
61 expected = blue;
62 else
63 expected = green;
65 pass &= piglit_probe_pixel_rgb(x, y, expected);
69 glutSwapBuffers();
71 return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE;
75 static void reshape(int width, int height)
77 piglit_width = width;
78 piglit_height = height;
80 glViewport(0, 0, width, height);
81 glMatrixMode(GL_PROJECTION);
82 glLoadIdentity();
84 glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
85 glMatrixMode(GL_MODELVIEW);
86 glLoadIdentity();
89 void
90 piglit_init(int argc, char **argv)
92 reshape(piglit_width, piglit_height);