void Render() {
        using namespace oglplus;

        gl.Clear().ColorBuffer().DoIt();

        GLfloat t = GLfloat(FrameTime());

        rndr.Use();

        text_stream.str(std::string());
        text_stream << "Time: " << std::fixed << std::setw(5)
                    << std::setprecision(3) << t << " [s]";
        if(time_str != text_stream.str()) {
            time_str = text_stream.str();
            time_layout.Set(time_str);
        }

        rndr.SetCamera(CamMatrixf::Orbiting(
          Vec3f(),
          GLfloat(9.0 + SineWave(t / 7.0) * 3.0),
          -FullCircles(t / 17.0),
          Degrees(SineWave(t / 21.0) * 35)));

        rndr.SetLayoutTransform(ModelMatrixf::Translation(-3.0f, 0.7f, 1.1f));
        rndr.Render(oglp_layout);

        rndr.SetLayoutTransform(ModelMatrixf::Translation(-6.0f, -0.7f, 0.0f));
        rndr.Render(desc_layout);

        rndr.SetLayoutTransform(
          ModelMatrixf::Translation(-4.0f, -2.0f, -0.5f) *
          ModelMatrixf::Scale(0.7f, 0.7f, 0.5f));
        rndr.Render(time_layout);
    }
	void Render(void)
	{
		using namespace oglplus;

		double t = FrameTime();

		gl.Clear().ColorBuffer().DepthBuffer();
		//
		auto camera = CamMatrixf::Orbiting(
			camera_target,
			camera_distance,
			-FullCircles(t / 17.0),
			Degrees(SineWave(t / 41.0) * 85)
		);
		camera_matrix.Set(camera);
		camera_position.Set(camera.Position());

		light_position.Set(
			CamMatrixf::Orbiting(
				camera_target,
				camera_distance*2.0,
				FullCircles(t / 37.0),
				Degrees(SineWave(t / 31.0) * 85)
			).Position()
		);

		face_normals.Set(int(t*0.25) % 2);

		gl.DrawElements(
			PrimitiveType::TriangleFan,
			element_count,
			DataType::UnsignedInt
		);
	}
    void Render() {
        using namespace oglplus;

        gl.Clear().ColorBuffer().StencilBuffer();

        glc.Color(0.2, 0.2, 1.0);

        text_path.StencilFillInstanced(
          glyph_indices,
          PathNVFillMode::CountUp,
          0xFF,
          PathNVTransformType::TranslateX,
          glyph_spacings);
        text_path.CoverFillInstanced(
          glyph_indices,
          PathNVFillCoverMode::BoundingBoxOfBoundingBoxes,
          PathNVTransformType::TranslateX,
          glyph_spacings);

        glc.Color(0.0, 0.0, 0.0);

        text_path.StencilStrokeInstanced(
          glyph_indices,
          1,
          ~0,
          PathNVTransformType::TranslateX,
          glyph_spacings);
        text_path.CoverStrokeInstanced(
          glyph_indices,
          PathNVStrokeCoverMode::ConvexHull,
          PathNVTransformType::TranslateX,
          glyph_spacings);
    }
Beispiel #4
0
  void drawScene() {
    gl.ClearColor(0.2, 0.2, 0.2, 1.0);
    gl.Clear().ColorBuffer().DepthBuffer();
    gl.Viewport(0, 0, 640, 480);

    // draw GUI
    System::getSingleton().renderAllGUIContexts();
  }
	void Render(void)
	{
		gl.Clear().ColorBuffer();

		gl.DrawArrays(
			oglplus::PrimitiveType::Triangles,
			0, 3
		);
	}
	void Render(void)
	{
		gl.Clear().ColorBuffer().DepthBuffer();
		//
		oglplus::Uniform<GLfloat>(prog, "Time") = FrameTime();

		// draw 36 instances of the cube
		// the vertex shader will take care of their placement
		cube_instr.Draw(cube_indices, 36);
	}
	void Render(void)
	{
		using namespace oglplus;

		gl.Clear().ColorBuffer().StencilBuffer();

		glc.Color(0.2, 0.2, 1.0);

		path.StencilFill(PathNVFillMode::CountUp, 0x1F);
		path.CoverFill(PathNVFillCoverMode::BoundingBox);

		glc.Color(0.1, 0.1, 0.1);

		path.StencilStroke(1, ~0);
		path.CoverStroke(PathNVStrokeCoverMode::ConvexHull);
	}
	void Display(void)
	{
		using namespace oglplus;

		gl.Clear().ColorBuffer();

		glc.Begin(CompatibilityPrimitiveType::Triangles);
			glc.Color(1.0, 0.0, 0.0);
			glc.Vertex(0.0f, 0.0f);

			glc.Color(0.0, 1.0, 0.0);
			glc.Vertex(1.0f, 0.0f);

			glc.Color(0.0, 0.0, 1.0);
			glc.Vertex(0.0f, 1.0f);
		glc.End();
	}
	void Render(void)
	{
		using namespace oglplus;

		gl.Clear().ColorBuffer().StencilBuffer();

		auto h = Height();
		int l = font_height / 2, i = 1;
		RenderText(l, h - font_height*i++, "NV_path_rendering");

		{
			std::stringstream s;
			s << "Frame no.: " << FrameNumber();
			RenderText(l, h - font_height*i++, s.str());
		}
		{
			std::stringstream s;
			s << std::fixed << std::setprecision(2);
			s << "Time: " << FrameTime() << " [s]";
			RenderText(l, h - font_height*i++, s.str());
		}
		{
			std::stringstream s;
			s << std::fixed << std::setprecision(2);
			s << "Average FPS: " << (FrameTime()>0.0 ? AverageFPS() : 0.0);
			RenderText(l, h - font_height*i++, s.str());
		}
		{
			std::stringstream s;
			s << std::fixed << std::setprecision(2);
			s << "Current FPS: " << (FrameDuration()>0.0 ? CurrentFPS() : 0.0);
			RenderText(l, h - font_height*i++, s.str());
		}
		{
			std::stringstream s;
			s << "Viewport: " << Width() << " x " << Height();
			RenderText(l, h - font_height*i++, s.str());
		}
		{
			std::stringstream s;
			s << std::fixed << std::setprecision(3);
			s << "Aspect ratio: " << Aspect();
			RenderText(l, h - font_height*i++, s.str());
		}
	}
Beispiel #10
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();
	}
	void Render(void)
	{
		using namespace oglplus;

		GLfloat t = GLfloat(FrameTime());
		GLfloat i = t*0.3f;
		int interval = int(i);
		GLfloat f = i - GLfloat(interval);
		if(prev_interval < interval)
		{
			LoadNext();
			prev_interval = interval;
		}

		gl.Clear().ColorBuffer().DoIt();

		rndr_opacity.Set(SineWave(f*0.5f));

		rndr.SetLayoutTransform(ModelMatrixf::TranslationZ(-20.0f+16.0f*f));
		rndr.Render(layout);
	}