/* Copyright © 2011 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. */ /** * \file drawbuffer.c * Verify specifying which color buffers are to be drawn into with drawbuffer function. * * This test works by call the function glDrawBuffer twice for each color buffer. * All the calls should ensure no error. * * \author Yi Sun */ #include "piglit-util.h" int piglit_width = 100, piglit_height = 100; int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE; int bufferlist[] = { GL_FRONT_AND_BACK, GL_FRONT, GL_BACK, GL_LEFT, GL_RIGHT, GL_FRONT_LEFT, GL_FRONT_RIGHT, GL_BACK_LEFT, GL_BACK_RIGHT, GL_NONE }; enum piglit_result piglit_display(void) { return PIGLIT_FAIL; } void piglit_init(int argc, char **argv) { bool pass = true; int i, repeat; GLenum err; for ( i=0; i < sizeof(bufferlist)/sizeof(bufferlist[0]); i++) { for ( repeat = 0; repeat < 2; repeat++ ) { glDrawBuffer( bufferlist[i] ); glRectf(-1.0,-1.0,1.0,1.0); } err = glGetError(); if (err != GL_NO_ERROR) { fprintf(stderr, "Generated a error while drawing buffer %d (%s, 0x%04x)\n", bufferlist[i], piglit_get_gl_error_name(err), err); pass = false; } } piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); }