Esempio n. 1
0
static GLboolean
test_simple_texture(int tex, int bias)
{
	GLboolean pass = GL_TRUE;
	int level;

	glBindTexture(GL_TEXTURE_2D, Textures[tex]);
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
	glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, bias);

	for(level = 0; level < 3; ++level) {
		float scale = scale_for_miplevel(bias, level);

		glPushMatrix();
		glScalef(SquareSize, SquareSize, 1.0);
		glTranslatef(level, tex, 0.0);
		glBegin(GL_QUADS);
			glTexCoord2f(0.0,   0.0);   glVertex2f(0, 0);
			glTexCoord2f(scale, 0.0);   glVertex2f(1, 0);
			glTexCoord2f(scale, scale); glVertex2f(1, 1);
			glTexCoord2f(0.0,   scale); glVertex2f(0, 1);
		glEnd();
		glPopMatrix();

		pass = probe_cell("test_simple", level, tex,
				  TextureData[tex][level]) && pass;
	}

	return pass;
}
Esempio n. 2
0
static GLboolean
test_multitex_combo(int bias1, int level1, int bias2, int level2)
{
	float scale1 = scale_for_miplevel(bias1, level1);
	float scale2 = scale_for_miplevel(bias2, level2);
	GLfloat expected[3];
	int i;

	for(i = 0; i < 3; ++i)
		expected[i] = TextureData[0][level1][i] + TextureData[1][level2][i];

	glPushMatrix();
	glScalef(SquareSize, SquareSize, 1.0);
	glTranslatef(level1, level2, 0.0);
	glBegin(GL_QUADS);
		glMultiTexCoord2f(GL_TEXTURE0, 0.0,    0.0);
		glMultiTexCoord2f(GL_TEXTURE1, 0.0,    0.0);
		glVertex2f(0, 0);

		glMultiTexCoord2f(GL_TEXTURE0, scale1, 0.0);
		glMultiTexCoord2f(GL_TEXTURE1, scale2, 0.0);
		glVertex2f(1, 0);

		glMultiTexCoord2f(GL_TEXTURE0, scale1, scale1);
		glMultiTexCoord2f(GL_TEXTURE1, scale2, scale2);
		glVertex2f(1, 1);

		glMultiTexCoord2f(GL_TEXTURE0, 0.0,    scale1);
		glMultiTexCoord2f(GL_TEXTURE1, 0.0,    scale2);
		glVertex2f(0, 1);
	glEnd();
	glPopMatrix();

	return probe_cell("multitex", level1, level2, expected);
}
Esempio n. 3
0
File: texgen.c Progetto: RAOF/piglit
/**
 * Sanity test whether the texture is rendered correctly at all.
 */
static void test_sanity(void)
{
	int x, y;

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

	glBegin(GL_QUADS);
		glTexCoord2f(0, 0);
		glVertex2f(0, 0);
		glTexCoord2f(1, 0);
		glVertex2f(1, 0);
		glTexCoord2f(1, 1);
		glVertex2f(1, 1);
		glTexCoord2f(0, 1);
		glVertex2f(0, 1);
	glEnd();

	for(y = 0; y < 4; ++y) {
		for(x = 0; x < 4; ++x)
			probe_cell("test_sanity", x, y, TextureData[y][x]);
	}

	piglit_present_results();
}
Esempio n. 4
0
File: texgen.c Progetto: RAOF/piglit
static void do_test_texgen_eye(const char* testname)
{
	static GLfloat sPlane1[4] = { 1.0, 0.0, 0.0, 0.25 };
	static GLfloat sPlane2[4] = { 1.0, 0.0, 0.0, -0.25 };
	static GLfloat sPlane3[4] = { -1.0, 0.0, 0.0, 1.25 };
	int x, y;

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

	// Note: Modelview matrix is identity
	glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
	glTexGenfv(GL_S, GL_EYE_PLANE, sPlane1);
	glEnable(GL_TEXTURE_GEN_S);

	// Draw lower left quad
	glBegin(GL_QUADS);
		glTexCoord2f(0, 0.25); glVertex2f(0.0, 0.0);
		glTexCoord2f(0, 0.25); glVertex2f(0.5, 0.0);
		glTexCoord2f(0, 0.75); glVertex2f(0.5, 0.5);
		glTexCoord2f(0, 0.75); glVertex2f(0.0, 0.5);
	glEnd();

	// Draw lower right quad
	glTexGenfv(GL_S, GL_EYE_PLANE, sPlane2);
	glPushMatrix();
	glTranslatef(0.5, -0.5, 0.0);
	glScalef(2.0, 1.0, 1.0);
	glBegin(GL_QUADS);
		glTexCoord2f(0, 0.25); glVertex2f(0.0,  0.5);
		glTexCoord2f(0, 0.25); glVertex2f(0.25, 0.5);
		glTexCoord2f(0, 0.75); glVertex2f(0.25, 1.0);
		glTexCoord2f(0, 0.75); glVertex2f(0.0,  1.0);
	glEnd();
	glPopMatrix();

	// Draw upper left quad
	glPushMatrix();
	glTranslatef(1.0, 0.5, 0.0);
	glScalef(-1.0, 1.0, 1.0);
	glTexGenfv(GL_S, GL_EYE_PLANE, sPlane3);
	glBegin(GL_QUADS);
		glTexCoord2f(0, 0.25); glVertex2f(1.0, 0.0);
		glTexCoord2f(0, 0.25); glVertex2f(0.5, 0.0);
		glTexCoord2f(0, 0.75); glVertex2f(0.5, 0.5);
		glTexCoord2f(0, 0.75); glVertex2f(1.0, 0.5);
	glEnd();
	glPopMatrix();

	glDisable(GL_TEXTURE_GEN_S);

	for(y = 0; y < 2; ++y) {
		for(x = 0; x < 2; ++x)
			probe_cell(testname, x, y, TextureData[y+1][x+1]);
	}

	piglit_present_results();
}