示例#1
0
//------------------------------------------------------------------------------
void Example::RenderFrame(double /*time*/)
{
	bool dragging = mouse_left_down || mouse_middle_down;

	if(dragging && (frame_no % 2))
	{
		gl.Scissor(
			mouse_x-screen_width/(view_divs*2),
			mouse_y-screen_height/(view_divs*2),
			screen_width/view_divs,
			screen_height/view_divs
		);
	}
	else
	{
		unsigned this_tile = view_tile_index[view_tile];
		gl.Scissor(
			(this_tile % view_divs)*screen_width/view_divs,
			(this_tile / view_divs)*screen_height/view_divs,
			screen_width/view_divs+1,
			screen_height/view_divs+1
		);

		if(++view_tile >= (dragging?view_divs:view_divs*view_divs))
		{
			view_tile = 0;
		}
	}

	screen.Draw();
	++frame_no;
}
示例#2
0
	void Render(void)
	{
		using namespace oglplus;

		gl.Clear().ColorBuffer().DepthBuffer();

		camera_matrix.Set(
			CamMatrixf::Orbiting(
				Vec3f(),
				9.5 - SineWave(FrameTime() / 6.0) * 7.0,
				FullCircles(FrameTime() / 9.0),
				Degrees(SineWave(FrameTime() / 30.0) * 90)
			)
		);

		model_matrix.Set(ModelMatrixf::RotationX(FullCircles(FrameTime() * 0.1)));

		textured_cube.Draw();
	}