当前位置: 首页>>代码示例>>C++>>正文


C++ Context::Clear方法代码示例

本文整理汇总了C++中Context::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Context::Clear方法的具体用法?C++ Context::Clear怎么用?C++ Context::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Context的用法示例。


在下文中一共展示了Context::Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();

		auto camera = CameraMat(time);

		mesh_proc.prog.model_matrix = ModelMat(time);
		mesh_proc.prog.camera_matrix = camera;
		dist_proc.prog.camera_matrix = camera;
		draw_proc.prog.camera_matrix = camera;

		mesh_proc();
		dist_proc(particles);
		sort_proc(particles);
		draw_proc(particles);
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:16,代码来源:029_gpu_sort_tfb.cpp

示例2: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();
		//
		// set the matrix for camera orbiting the origin
		Uniform<Mat4f>(prog, "CameraMatrix").Set(
			CamMatrixf::Orbiting(
				Vec3f(),
				5.0,
				FullCircles(time / 17.0),
				Degrees(SineWave(time / 19.0) * 90)
			)
		);

		torus_instr.Draw(torus_indices);
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:16,代码来源:017_phong_torus.cpp

示例3: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();
		//
		// set the matrix for camera orbiting the origin
		camera_matrix.Set(
			CamMatrixf::Orbiting(
				Vec3f(),
				4.5f,
				FullCircles(time / 10.0),
				Degrees(45.0 + SineWave(time / 7.0)*30.0)
			)
		);
		model_matrix.Set(ModelMatrixf::RotationX(FullCircles(time / 12.0)));

		torus_instr.Draw(torus_indices);
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:17,代码来源:017_clipped_torus.cpp

示例4: Render

    void Render(double time) {
        gl.Clear().ColorBuffer().DepthBuffer();
        //
        auto lightAzimuth = FullCircles(time * -0.5);
        light_pos.Set(
          Vec3f(-Cos(lightAzimuth), 1.0f, -Sin(lightAzimuth)) * 2.0f);
        //
        camera_matrix.Set(CamMatrixf::Orbiting(
          Vec3f(), 3.0f, Degrees(-45), Degrees(SineWave(time / 30.0) * 70)));

        // set the model matrix
        model_matrix.Set(ModelMatrixf::RotationA(
          Vec3f(1.0f, 1.0f, 1.0f), FullCircles(-time * 0.05)));

        gl.CullFace(Face::Back);
        cube_instr.Draw(cube_indices);
    }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:17,代码来源:022_parallax_map.cpp

示例5: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();
		//
		// make the light position vector
		auto light = Vec3f(2.0f, 2.0f, 2.0f);
		// make the matrix for camera orbiting the origin
		auto camera = CamMatrixf::Orbiting(
			Vec3f(),
			6.0,
			Degrees(time * 15),
			Degrees(SineWave(time / 6.0) * 45)
		);
		// render the shapes
		sphere.Render(light, camera, Mat4f());
		cubeX.Render(
			light,
			camera,
			ModelMatrixf::Translation(2.0f, 0.0f, 0.0f) *
			ModelMatrixf::RotationX(Degrees(time * 45))
		);
		cubeY.Render(
			light,
			camera,
			ModelMatrixf::Translation(0.0f, 2.0f, 0.0f) *
			ModelMatrixf::RotationY(Degrees(time * 90))
		);
		cubeZ.Render(
			light,
			camera,
			ModelMatrixf::Translation(0.0f, 0.0f, 2.0f) *
			ModelMatrixf::RotationZ(Degrees(time * 135))
		);
		torus.Render(
			light,
			camera,
			ModelMatrixf::Translation(-1.0f, -1.0f, -1.0f) *
			ModelMatrixf::RotationA(
				Vec3f(1.0f, 1.0f, 1.0f),
				Degrees(time * 45)
			) *
			ModelMatrixf::RotationY(Degrees(45)) *
			ModelMatrixf::RotationX(Degrees(45))
		);
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:45,代码来源:020_shaded_objects.cpp

示例6: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();
		//
		// set the matrix for camera orbiting the origin
		camera_matrix.Set(
			CamMatrixf::Orbiting(
				Vec3f(0.0f, 0.5f, 0.0f),
				6.5,
				Degrees(time * 35),
				Degrees(55 - SineWave(time / 20.0) * 30)
			)
		);
		light_pos.Set(light_path.Position(time / 10.0));

		plane.Bind();
		plane_instr.Draw(plane_indices);
	}
开发者ID:James-Z,项目名称:oglplus,代码行数:18,代码来源:018_newton_landscape.cpp

示例7: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();

		auto camera = CamMatrixf::Orbiting(
			Vec3f(),
			6.0,
			FullCircles(time / 10.0),
			Degrees(45.0 + SineWave(time / 7.0)*30.0)
		);
		auto model = ModelMatrixf::RotationX(FullCircles(time / 12.0));

		plane_camera_matrix.Set(camera);
		torus_camera_matrix.Set(camera);
		torus_model_matrix.Set(model);

		BSP(camera, 0);
	}
开发者ID:detunized,项目名称:oglplus,代码行数:18,代码来源:022_xyz_planes.cpp

示例8: Render

	void Render(double /*time*/)
	{
		gl.Clear().ColorBuffer();
		// draw the lines between control points
		color = Vec3f(0.9f, 0.9f, 0.2f);
		control.Bind();
		gl.DrawArrays(PrimitiveType::LineStrip, 0, ctrl_n);
		// draw the curve
		color = Vec3f(0.1f, 0.1f, 0.1f);
		curve.Bind();
		gl.DrawArrays(PrimitiveType::LineStrip, 0, curve_n);
		// draw the control points
		color = Vec3f(0.9f, 0.0f, 0.0f);
		control.Bind();
		gl.PointSize(8.0);
		gl.DrawArrays(PrimitiveType::Points, 0, ctrl_n);
		gl.PointSize(1.0);
	}
开发者ID:BrainlessLabsInc,项目名称:oglplus,代码行数:18,代码来源:007_cubic_bezier.cpp

示例9: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();
		//
		// set the matrix for camera orbiting the origin
		camera_matrix.Set(
			CamMatrixf::Orbiting(
				Vec3f(),
				18.5,
				Degrees(time * 135),
				Degrees(SineWave(time / 20.0) * 30)
			)
		);

		// draw 36 instances of the cube
		// the vertex shader will take care of their placement
		cube_instr.Draw(cube_indices, 36);
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:18,代码来源:014_multi_cube_ub.cpp

示例10: Render

    void Render(double time) {
        gl.Clear().ColorBuffer().DepthBuffer();

        CamMatrixf camera = CamMatrixf::Orbiting(
          Vec3f(),
          4.5f + float(SineWave(time / 25.0)),
          FullCircles(time / 30.0),
          Degrees(SineWave(time / 19.0) * 20));
        light_prog.camera_matrix.Set(camera);
        flare_prog.camera_matrix.Set(camera);
        shape_prog.camera_matrix.Set(camera);
        shape_prog.camera_position.Set(camera.Position());

        shape_prog.model_matrix.Set(
          ModelMatrixf::RotationX(FullCircles(time / 30.0)));

        shape_prog.Use();
        shape.Draw();
        NoProgram().Use();

        lights.Bind();

        light_prog.Use();

        for(GLuint l = 0; l != n_flares; ++l) {
            queries[l].Begin(Query::Target::SamplesPassed);
            gl.DrawArrays(PrimitiveType::Points, l, 1);
            queries[l].End(Query::Target::SamplesPassed);
        }

        gl.Enable(Capability::Blend);
        gl.Disable(Capability::DepthTest);
        flare_prog.Use();
        for(GLuint l = 0; l != n_flares; ++l) {
            GLint samples = 0;
            queries[l].WaitForResult(samples);
            if(samples != 0) {
                flare_prog.samples = samples;
                gl.DrawArrays(PrimitiveType::Points, l, 1);
            }
        }
        gl.Enable(Capability::DepthTest);
        gl.Disable(Capability::Blend);
    }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:44,代码来源:029_flares.cpp

示例11: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();
		//
		edge_width.Set(4.0+SineWave(time / 7.0)*3.0);

		camera_matrix.Set(
			CamMatrixf::Orbiting(
				Vec3f(),
				5.5 - SineWave(time / 27)*2.0,
				Degrees(time * 33),
				Degrees(SineWave(time / 21.0) * 31)
			)
		);

		model_matrix.Set(ModelMatrixf::RotationZ(Degrees(time * 37)));

		shape_instr.Draw(shape_indices);
	}
开发者ID:BrainlessLabsInc,项目名称:oglplus,代码行数:19,代码来源:017_single_pass_edges.cpp

示例12: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();
		//
		// set the matrix for camera orbiting the origin
		camera_matrix.Set(
			CamMatrixf::Orbiting(
				Vec3f(),
				3.5,
				Degrees(time * 35),
				Degrees(SineWave(time / 60.0) * 80)
			)
		);
		// set the model matrix
		model_matrix.Set(
			ModelMatrixf::RotationX(FullCircles(time * 0.25))
		);

		torus_instr.Draw(torus_indices);
	}
开发者ID:xdray,项目名称:oglplus,代码行数:20,代码来源:016_metallic_torus.cpp

示例13: Render

    void Render(double time) {
        gl.Clear().ColorBuffer().DepthBuffer();

        auto camera = CamMatrixf::Orbiting(
          Vec3f(),
          2.9f,
          FullCircles(time / 17.0),
          Degrees(45 + SineWave(time / 20.0) * 40));

        camera_matrix.Set(camera);
        camera_position.Set(camera.Position());

        auto langle = FullCircles(time / 31.0);
        light_position.Set(
          GLfloat(Cos(langle) * 20.0f),
          GLfloat((1.2 + Sin(langle)) * 15.0f),
          GLfloat(Sin(langle) * 20.0f));

        shape.Draw();
    }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:20,代码来源:029_muddy_stones.cpp

示例14: Render

    void Render(double time)
    {
        gl.Clear().ColorBuffer().DepthBuffer();
        //
        // set the matrix for camera orbiting the origin
        camera_matrix.Set(
            CamMatrixf::LookingAt(
                cam_path.Position(time / 9.0),
                tgt_path.Position(time / 7.0)
            )
        );

        // draw the points
        gl.DrawArrays(PrimitiveType::Points, 0, node_count * 3);
        // draw the edges
        gl.DrawElements(
            PrimitiveType::Lines,
            edge_count,
            DataType::UnsignedInt
        );
    }
开发者ID:xdray,项目名称:oglplus,代码行数:21,代码来源:015_graph.cpp

示例15: Render

	void Render(double time)
	{
		gl.Clear().ColorBuffer().DepthBuffer();

		auto camera = CamMatrixf::Orbiting(
			Vec3f(),
			8.5,
			FullCircles(time / 5.0),
			Degrees(15 + (-SineWave(time/10.0)+1.0)* 0.5 * 75)
		);
		ModelMatrixf model =
			ModelMatrixf::Translation(0.0f, 2.5f, 0.0) *
			ModelMatrixf::RotationA(
				Vec3f(1.0f, 1.0f, 1.0f),
				FullCircles(time / 7.0)
			);

		plane_prog.Use();
		plane_camera_matrix.Set(camera);

		plane.Bind();
		gl.DrawArrays(PrimitiveType::TriangleStrip, 0, 4);

		shape_prog.Use();
		shape_camera_matrix.Set(camera);

		shape_model_matrix.Set(model);
		shape.Bind();
		shape_instr.Draw(shape_indices);

		halo_prog.Use();
		halo_camera_matrix.Set(camera);
		halo_model_matrix.Set(model);

		gl.DepthMask(false);
		gl.Enable(Capability::Blend);
		shape_instr.Draw(shape_indices);
		gl.Disable(Capability::Blend);
		gl.DepthMask(true);
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:40,代码来源:026_shape_halo.cpp


注:本文中的Context::Clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。