Add more structure constructor tests.
[piglit/hramrach.git] / tests / general / user-clip.c
blob7cd32d6c82826fe624d93ba8cfaf3c31eae08f1b
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.
24 /**
25 * \file user-clip.c
27 * \author Ian Romanick <ian.d.romanick@intel.com>
30 #include "piglit-util.h"
31 #include "piglit-framework.h"
33 #define ELEMENTS(x) (sizeof(x) / sizeof(x[0]))
35 #define BOX_SIZE 32
38 int piglit_window_mode = GLUT_DOUBLE;
39 int piglit_width = 100;
40 int piglit_height = 100;
45 static const GLfloat clear_color[4] = { 0.5, 0.5, 0.5, 1.0 };
48 enum piglit_result
49 piglit_display(void)
51 static const GLfloat green[4] = { 0.0, 1.0, 0.0, 1.0 };
52 static const GLfloat red[4] = { 1.0, 0.0, 0.0, 1.0 };
53 enum piglit_result result = PIGLIT_SUCCESS;
55 glClear(GL_COLOR_BUFFER_BIT);
57 glBegin(GL_TRIANGLES);
58 glColor4fv(green);
59 glVertex3f(-1.0, 1.0, 0.0);
60 glColor4fv(red);
61 glVertex3f( 2.0, 0.0, 1.0);
62 glColor4fv(green);
63 glVertex3f(-1.0, -1.0, 0.0);
64 glEnd();
66 if (!piglit_probe_pixel_rgb(piglit_width - 2,
67 piglit_height / 2,
68 clear_color)) {
69 result = PIGLIT_FAILURE;
72 glutSwapBuffers();
73 return result;
77 void
78 piglit_init(int argc, char **argv)
80 GLdouble clip_plane[4] = {
81 0.0, 0.0, -1.0, 0.5
84 (void) argc;
85 (void) argv;
87 glClearColor(clear_color[0],
88 clear_color[1],
89 clear_color[2],
90 clear_color[3]);
92 glClipPlane(GL_CLIP_PLANE0, clip_plane);
93 glEnable(GL_CLIP_PLANE0);