Hello Guest

[Help request][Solved] AngelCodeFont with transparent "background".

  • 2 Replies
  • 3141 Views
I'm quite new to all this fancy stuff. I'm writing a program which would benefit a lot from being able to render text in front of a colored quad.
At the moment I'm initializing the AngelCodeFont and all the OpenGL things. The render() looks something like this. (Screen is cleared before)
Code: [Select]
public void render(AngelCodeFont font) {
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2f(x - size+5, y - size+5);
GL11.glVertex2f(x + size-5, y - size+5);
GL11.glVertex2f(x + size-5, y + size-5);
GL11.glVertex2f(x - size+5, y + size-5);
GL11.glEnd();
// Draw the value!
GL11.glEnable(GL11.GL_TEXTURE_2D);
font.drawString(x-20, y-20, "" + value);
GL11.glDisable(GL11.GL_TEXTURE_2D);
}
And together with the rest of the code it renders like this:

Now, is there anyway to make the black background on each glyph to "be rendered transparent" (not really sure what the correct term/approach is here)?
Thanks for your time :).
« Last Edit: September 08, 2011, 12:32:46 by vincentm »

Re: [Help request] AngelCodeFont with transparent "background".
« Reply #1 on: September 07, 2011, 19:01:58 »
Of course. Basically, you determine that setting before exporting the font image.

I believe (don't have the program with me) in "Export options" you need to set it to export a 32-bit image instead of 8-bit, and set the exported image to "white text with alpha."

Re: [Help request][Solved] AngelCodeFont with transparent "background".
« Reply #2 on: September 08, 2011, 12:34:10 »
Thanks, got the blending to work now :)
Had to turn on alpha-blending. Only problem now is that the glyphs aren't correctly "cut-out", they look like random signs.