Add more structure constructor tests.
[piglit/hramrach.git] / tests / general / dlist-fdo3129-02.c
blob13a2b6bc00fbf9ef28042c36d803f732d41f12f9
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 dlist-fdo3129-02.c
26 * Test odd combinations of command in a display list.
28 * This test is based on a test case posted to fdo bug #3129 by Nicolai Hähnle.
29 * Once upon a time, this triggered an assertion failure in Mesa.
31 #include "piglit-util.h"
32 #include "piglit-framework.h"
34 int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;
35 int piglit_width = 256;
36 int piglit_height = 256;
38 static GLuint list;
40 enum piglit_result
41 piglit_display(void)
43 enum piglit_result result = PIGLIT_SUCCESS;
44 static const GLfloat color[4] = { 1.0, 1.0, 1.0, 1.0 };
46 glClear (GL_COLOR_BUFFER_BIT);
48 /* Set some values outside the list.
50 glColor3fv(color);
53 /* Compile a list. Start with two-component vertexes, then, after the
54 * first primitive is complete, use a three-component vertex.
55 * in the list.
57 glNewList(list, GL_COMPILE);
59 glBegin(GL_TRIANGLE_STRIP);
60 glVertex2f(piglit_width / 4, piglit_height / 4);
61 glVertex2f((piglit_width * 3) / 4, piglit_height / 4);
62 glVertex2f((piglit_width * 3) / 4, (piglit_height * 3) / 4);
63 glVertex3f(piglit_width / 4, (piglit_height * 3) / 4, 0.1);
64 glEnd();
66 glEndList();
68 glCallList(list);
70 if (!piglit_probe_pixel_rgb(piglit_width / 2,
71 piglit_height / 2,
72 color)) {
73 result = PIGLIT_FAILURE;
76 glutSwapBuffers();
78 return result;
82 void
83 piglit_init(int argc, char **argv)
85 (void) argc;
86 (void) argv;
88 piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
89 list = glGenLists(1);