2 * (C) Copyright IBM Corporation 2006
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * on the rights to use, copy, modify, merge, publish, distribute, sub
9 * license, and/or sell copies of the Software, and to permit persons to whom
10 * the Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
28 * Simple test of APPLE_vertex_array_object functionality. This test creates
29 * a VAO, pushed it (via \c glPushClientAttrib), modifies the VAO, then pops
30 * it (via \c glPopClientAttrib). After popping, the state of the VAO is
33 * According to the APPLE_vertex_array_object spec, the contents of the VAO
34 * should be restored to the values that they had when pushed.
36 * \author Ian Romanick <idr@us.ibm.com>
39 #include "piglit-util.h"
41 int piglit_width
= 400;
42 int piglit_height
= 200;
43 int piglit_window_mode
= GLUT_RGB
| GLUT_DOUBLE
;
48 return PIGLIT_SUCCESS
;
52 piglit_init(int argc
, char **argv
)
57 if (!GLEW_APPLE_vertex_array_object
) {
58 printf("Sorry, this program requires GL_APPLE_vertex_array_object\n");
59 piglit_report_result(PIGLIT_SKIP
);
62 glGenVertexArraysAPPLE(1, & obj
);
63 glBindVertexArrayAPPLE(obj
);
64 glVertexPointer(4, GL_FLOAT
, sizeof(GLfloat
) * 4, (void *) 0xDEADBEEF);
65 glEnableClientState(GL_VERTEX_ARRAY
);
67 glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT
);
69 glVertexPointer(4, GL_FLOAT
, sizeof(GLfloat
) * 4, (void *) 0xBADDC0DE);
70 glDisableClientState(GL_VERTEX_ARRAY
);
74 if (! glIsEnabled(GL_VERTEX_ARRAY
)) {
75 printf("Array state is incorrectly disabled.\n");
76 piglit_report_result(PIGLIT_FAILURE
);
79 glGetPointerv(GL_VERTEX_ARRAY_POINTER
, & ptr
);
80 if (ptr
!= (void *) 0xDEADBEEF) {
81 printf("Array pointer is incorrectly set to 0x%p.\n", ptr
);
82 piglit_report_result(PIGLIT_FAILURE
);
85 piglit_report_result(PIGLIT_SUCCESS
);