Exemplo n.º 1
0
        public static void DrawStringStatic(string text, double startX, double startY, double startZ)
        {
            TextRendererAdapted textRenderer = new TextRendererAdapted(35, 35);
            Font serif = new Font(FontFamily.GenericSerif, 24);

            System.Drawing.Color backColor = Color.WhiteSmoke;
            Brush textBrush = Brushes.Black;

            GL.Enable(EnableCap.Texture2D);
            GL.BindTexture(TextureTarget.Texture2D, textRenderer.Texture);

            textRenderer.Clear(backColor);
            textRenderer.DrawString(text, serif, textBrush, new PointF(0.0f, 0.0f));

            double realHeight = 0.2f;
            double realWidth  = 0.2f;

            GL.Begin(PrimitiveType.Quads);

            GL.TexCoord3(0.0f, 0.0f, 0f); GL.Vertex3(startX, startY, startZ);
            GL.TexCoord3(1.0f, 0.0f, 0f); GL.Vertex3(startX + realWidth, startY, startZ);
            GL.TexCoord3(1.0f, 1.0f, 0f); GL.Vertex3(startX + realWidth, startY + realHeight, startZ);
            GL.TexCoord3(0.0f, 1.0f, 0f); GL.Vertex3(startX, startY + realHeight, startZ);

            GL.End();
        }
Exemplo n.º 2
0
 public OpenGLTextWriter()
 {
     textRenderer = new TextRendererAdapted(35, 35);
     //textRenderer = new TextRenderer(35, 35);
 }