Tao.FreeGlut SDK Documentation

Glut.glutStrokeCharacter Method 

Renders a stroke character using OpenGL.

[Visual Basic]
Public Shared Sub glutStrokeCharacter( _
   ByVal font As IntPtr, _
   ByVal character As Integer _
)
[C#]
public static void glutStrokeCharacter(
   IntPtr font,
   int character
);

Parameters

font

Stroke font to use. Without using any display lists, glutStrokeCharacter renders the character in the named stroke font. The available fonts are:

Value Description
GLUT_STROKE_ROMAN A proportionally spaced Roman Simplex font for ASCII characters 32 through 127. The maximum top character in the font is 119.05 units; the bottom descends 33.33 units.
GLUT_STROKE_MONO_ROMAN A mono-spaced spaced Roman Simplex font (same characters as GLUT_STROKE_ROMAN) for ASCII characters 32 through 127. The maximum top character in the font is 119.05 units; the bottom descends 33.33 units. Each character is 104.76 units wide.

character
Character to render (not confined to 8 bits).

Remarks

Rendering a nonexistent character has no effect. A Gl.glTranslatef is used to translate the current model view matrix to advance the width of the character.

EXAMPLE

Here is a routine that shows how to render a text string with glutStrokeCharacter:

            private void PrintText(float x, float y, string text) {
            GL.glPushMatrix();
            Gl.glTranslatef(x, y, 0);
            foreach(char c in text) {
            Glut.glutStrokeCharacter(Glut.GLUT_STROKE_ROMAN, c);
            }
            Gl.glPopMatrix();
            }
            

If you want to draw stroke font text using wide, antialiased lines, use:

            Gl.glBlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA);
            Gl.glEnable(Gl.GL_BLEND);
            Gl.glEnable(Gl.GL_LINE_SMOOTH);
            Gl.glLineWidth(2.0f);
            PrintText(200, 225, "This is antialiased.");
            

See Also

Glut Class | Tao.FreeGlut Namespace | glutBitmapCharacter | glutStrokeWidth