/**
* Render a text string in 2D over the scene, using the character set created
* by this GLFont object.
*
* @see makeFont()
*/
public void print(int x, int y, String msg)
{
if (msg != null) {
// preserve current GL settings
GLApp.pushAttribOrtho();
{
// turn off lighting
GL11.glDisable(GL11.GL_LIGHTING);
// enable alpha blending, so character background is transparent
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// enable the charset texture
GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureHandle);
// prepare to render in 2D
GLApp.setOrthoOn();
// draw the text
GL11.glTranslatef(x, y, 0); // Position The Text (in pixel coords)
for(int i=0; i<msg.length(); i++) {
GL11.glCallList(fontListBase + (msg.charAt(i)-32));
}
// restore the original positions and views
GLApp.setOrthoOff();
}
GLApp.popAttrib(); // restore previous settings
}
}