PrintToVBO() public method

public PrintToVBO ( string text, QFontAlignment alignment, Vector3 position, Color color, SizeF maxSize ) : void
text string
alignment QFontAlignment
position Vector3
color Color
maxSize System.Drawing.SizeF
return void
Beispiel #1
0
        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;
        }