Пример #1
0
static void Key(unsigned char key, int x, int y)
{

    switch (key) {
      case 27:
	exit(1);
      case '1':
	mode1 = !mode1;
	break;
      case '2':
	mode2 = !mode2;
	break;
      case '3':
	RotateColorMask();
	break;
      case 'p':
         if (provoking == GL_FIRST_VERTEX_CONVENTION_EXT) {
            printf("provoke last\n");
            provoking = GL_LAST_VERTEX_CONVENTION_EXT;
         }
         else {
            printf("provoke first\n");
            provoking = GL_FIRST_VERTEX_CONVENTION_EXT;
         }
         glProvokingVertexEXT(provoking);
         break;
      default:
	return;
    }

    glutPostRedisplay();
}
enum piglit_result
piglit_display(void)
{
	static const float red[3] = {1, 0, 0},
		green[3] = {0, 1, 0},
		blue[3] = {0, 0, 1},
		yellow[3] = {1, 1, 0},
		cyan[3] = {0, 1, 1};

	bool pass = true;

	glClear(GL_COLOR_BUFFER_BIT);
	glProvokingVertexEXT(GL_LAST_VERTEX_CONVENTION_EXT);

	const int y1 = piglit_height / 3;

	glBegin(GL_TRIANGLE_STRIP);
		glColor3fv(cyan);
		glVertex3i(piglit_width + 1, y1, 0);
		glColor3fv(yellow);
		glVertex3i(piglit_width + 2, y1, 0);
		glColor3fv(blue);
		glVertex3i(piglit_width + 3, y1, 0);
		glColor3fv(green);
		glVertex3i(piglit_width / 2, y1 * 2, 0);
		glColor3fv(red);
		glVertex3i(piglit_width - 1, y1 * 2, 0);
	glEnd();

	pass = pass && piglit_probe_pixel_rgb(piglit_width - 2, y1 * 3 / 2, red);

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}