Hey everybody,
I have a problem with my 3D project where I’m rendering a 2D text in front of the scene.
I am using the GLApp engine/library (don’t know if you heard about it) and a method that renders the text for me.
An example of use:
yourFont.print(float cordX, float cordY, String text);
So, here’s the code of the method print() of the GLApp library:
/**
* 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
}
}
If I want to output “Grün”, I get “Grn” on the screen instead witch is really weird, I don’t even get a question mark or something!..
Maybe if someone knows GLApp or the way it is rendering the text, he could help?
Changing the font didn’t work.
Best regards,
- phpART