Example #1
0
void LLDrawPoolAlpha::render(S32 pass)
{
	LLFastTimer t(LLFastTimer::FTM_RENDER_ALPHA);
	
	LLGLEnable clip(GL_CLIP_PLANE0);
	setup_clip_plane(TRUE);
	render(gPipeline.mAlphaGroups);
}
Example #2
0
void LLDrawPoolAlphaPostWater::render(S32 pass)
{
    LLFastTimer t(LLFastTimer::FTM_RENDER_ALPHA);

	if (gPipeline.hasRenderType(LLDrawPool::POOL_ALPHA))
	{
		LLGLEnable clip(GL_CLIP_PLANE0);
		setup_clip_plane(FALSE);
		LLDrawPoolAlpha::render(gPipeline.mAlphaGroupsPostWater);
	}
	else
	{
		LLDrawPoolAlpha::render(gPipeline.mAlphaGroupsPostWater);
	}
}
bool
measure_effects(char *desc, int mc, int pc, int md, int pd, int expected)
{
	float size = 0.1;
	float dist = 1.0 - size/2;

	int angle;

	printf("Measuring %s: ", desc);

	glClear(GL_COLOR_BUFFER_BIT);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glRotatef(mc, 0, 0, 1);

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glRotatef(pc, 0, 0, 1);

	setup_clip_plane(0,  1.0,  0.0, 0.0, size-1.0); /* x > 1.0-size */
	setup_clip_plane(1, -1.0,  0.0, 0.0,      1.0); /* x < 1.0 */
	setup_clip_plane(2,  0.0,  1.0, 0.0,   size/2); /* y > -size/2 */
	setup_clip_plane(3,  0.0, -1.0, 0.0,   size/2); /* y < size/2 */
	glEnable(GL_CLIP_PLANE0);
	glEnable(GL_CLIP_PLANE1);
	glEnable(GL_CLIP_PLANE2);
	glEnable(GL_CLIP_PLANE3);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glRotatef(md, 0, 0, 1);

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glRotatef(pd, 0, 0, 1);

	piglit_draw_rect(-2, -2, 4, 4);

	for (angle = -180; angle < 180; angle += 10) {
		float angle_rad = angle * M_PI / 180.0;
		float xf = dist * cos(angle_rad);
		float yf = dist * sin(angle_rad);
		int x = (int) (0.5 + piglit_width * (xf + 1.0)/2.0);
		int y = (int) (0.5 + piglit_width * (yf + 1.0)/2.0);
		float found_color[4];
		glReadPixels(x, y, 1, 1, GL_RGBA, GL_FLOAT, found_color);
		if (found_color[0] > 0.5) {
			if (angle == expected) {
				printf("OK (angle=%d)\n", angle);
				return true;
			} else {
				printf("FAIL (angle=%d, expected=%d)\n", angle,
				       expected);
				return false;
			}
		}
	}
	printf("FAIL (test rect not found, expected=%d)\n", expected);
	return false;
}