/// <summary> /// Self explanatory, sets up the Qfont parameters /// </summary> private void setupFont() { var config = new QFontBuilderConfiguration() { UseVertexBuffer = true, TextGenerationRenderHint = TextGenerationRenderHint.SystemDefault }; mFont = new QFont( "Core/times.ttf", 16, config ); //mFont.PrintToVBO( "i love", new Vector3( 0, 0, 0 ), Color.Red ); //mFont.PrintToVBO( "quickfont", new Vector3( 0, 10, 0 ), Color.Blue ); mFont.LoadVBOs(); }
private void PrintWithBoundsVBO(QFont font, string text, RectangleF bounds, QFontAlignment alignment, ref float yOffset) { GL.Disable(EnableCap.Texture2D); GL.Color4(1.0f, 0f, 0f, 1.0f); float maxWidth = bounds.Width; float height = font.Measure(text, new SizeF(maxWidth, float.MaxValue), alignment).Height; GL.Begin(BeginMode.LineLoop); GL.Vertex3(bounds.X, bounds.Y, 0f); GL.Vertex3(bounds.X + bounds.Width, bounds.Y, 0f); GL.Vertex3(bounds.X + bounds.Width, bounds.Y + height, 0f); GL.Vertex3(bounds.X, bounds.Y + height, 0f); GL.End(); font.ResetVBOs(); font.PrintToVBO(text, new SizeF(maxWidth, float.MaxValue), alignment, new Vector2(bounds.X, bounds.Y)); font.LoadVBOs(); font.DrawVBOs(); yOffset += height; }