コード例 #1
0
/** Verify rendered polygon anisotropy.
 *
 *  @param gl  OpenGL functions wrapper
 *
 *  @return Returns points value. Less points means better anisotropy (smoother strips).
 */
GLuint TextureFilterAnisotropicDrawingTestCase::verifyScene(const glw::Functions& gl)
{
	std::vector<GLubyte> pixels;
	pixels.resize(32 * 8 * 4);

	gl.readPixels(0, 23, 32, 8, GL_RGBA, GL_UNSIGNED_BYTE, pixels.data());
	GLU_EXPECT_NO_ERROR(gl.getError(), "glReadPixels");

	GLuint sum = 0;

	GLubyte last	= 0;
	GLubyte current = 0;
	for (int j = 0; j < 8; ++j)
	{
		for (int i = 0; i < 32; ++i)
		{
			current = pixels[(i + j * 32) * 4];

			if (i > 0)
				sum += deAbs32((int)current - (int)last);

			last = current;
		}
	}

	return sum;
}