示例#1
0
文件: fbo-1d.c 项目: blaztinn/piglit
enum piglit_result
piglit_display(void)
{
	GLboolean pass = GL_TRUE;
	float red[] = {1,0,0,0};
	float green[] = {0,1,0,0};
	float *expected;
	int x;
	GLuint tex;

	glClearColor(1.0, 1.0, 1.0, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);

	tex = create_1d_fbo();

	draw_fbo_1d(10, 10);

	for (x = 0; x < BUF_WIDTH; x++) {
		if (x < BUF_WIDTH / 2)
			expected = red;
		else
			expected = green;

		pass &= piglit_probe_pixel_rgb(10 + x, 10, expected);
	}

	glDeleteTextures(1, &tex);

	glutSwapBuffers();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
示例#2
0
enum piglit_result piglit_display(void)
{
	GLboolean pass = GL_TRUE;
	float black[] = {0,0,0,0};
	float green[] = {0,1,0,0};
	float *expected;
	int x;
	GLuint tex, ds;

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	glClearColor(1.0, 1.0, 1.0, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);

	create_1d_fbo(&tex, &ds);

	glBindTexture(GL_TEXTURE_1D, tex);
	draw_fbo_1d(10, 10);
	glBindTexture(GL_TEXTURE_1D, ds);
	draw_fbo_1d(10+BUF_WIDTH, 10);

	for (x = 0; x < BUF_WIDTH*2; x++) {
		if (x < BUF_WIDTH)
			expected = green;
		else
			expected = black;

		pass &= piglit_probe_pixel_rgb(10 + x, 10, expected);
	}

	glDeleteTextures(1, &tex);
	glDeleteTextures(1, &ds);

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}