Printing with one call.

Home


Fontlib has two functions to change behaviors of FontLib. Behaviors of fontBind can be changed using fontSetState and behaviors of fontPrint can be changeded using fontSetBind and possibly fontSetAutoBindFont if FONT_AUTO_BIND_FLUSH is set.

The API reference contains all the flags; I'll just focus on two of the more important ones.

print just by calling fontPrint()

Initalization Code

fontInit();
fontLoad("MsSerfTerminal.tga","MsSerfTerminalData.dat","MsSerf","Terminal");
fontSetBind(FONT_AUTO_BIND_FLUSH);
fontSetAutoBindFont("MsSerf");

Rendering Code

fontPrint("Hello World", -10.0f, -10.0f, 0, 0.4);


Simple and easy. The only catch is, each print will change OpenGL's state machine, so it's only useful if you're printing a single message.