コード例 #1
0
	void RenderText(GLfloat x, GLfloat y, const oglplus::String& text)
	{
		using namespace oglplus;

		glyph_spacings.resize(text.size()+1);
		text_glyphs.GetSpacing(
			PathNVListMode::AccumAdjacentPairs,
			text,
			1.0f, 1.0f,
			PathNVTransformType::TranslateX,
			glyph_spacings
		);
		glyph_spacings.insert(glyph_spacings.begin(), 0);

		dsa.ModelviewMatrix()
			.LoadIdentity()
			.Translate(x, y, 0);

		text_glyphs.StencilFillInstanced(
			text,
			PathNVFillMode::CountUp,
			0xFF,
			PathNVTransformType::TranslateX,
			glyph_spacings
		);
		text_glyphs.CoverFillInstanced(
			text,
			PathNVFillCoverMode::BoundingBoxOfBoundingBoxes,
			PathNVTransformType::TranslateX,
			glyph_spacings
		);
	}
コード例 #2
0
    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);
    }