So, I load a TrueTypeFont like this:

   private TrueTypeFont trueTypeFont;
   try {
        InputStream inputStream = ResourceLoader.getResourceAsStream("assets/fonts/main.ttf");

        Font awtFont2 = Font.createFont(Font.TRUETYPE_FONT, inputStream);
        awtFont2 = awtFont2.deriveFont(24f); // set font size
        trueTypeFont = new TrueTypeFont(awtFont2, true);

    } catch (Exception e) {

After that, I draw a textured quad, as one usualyy would and then, draw trueTypeFont.drawString(this.x, this.y, this.text, Color.white); . What this gives, however is far from text, this is what it does, the black is supposed to be text...

enter image description here

How to fix?


1 Answer 1


You get the black boxes because you have to enable blending in OpenGL:


This because the textures drawn by Slick have transparency.

  • \$\begingroup\$ K, that causes puu.sh/aA554/09203ae10e.png ... the small black thingy I recognize as a part of the sprite sheet, I texturized the quad with... do I need to un-bind the texture somehow? \$\endgroup\$
    – Rando Hinn
    Aug 1, 2014 at 11:06
  • \$\begingroup\$ Or what should I do? \$\endgroup\$
    – Rando Hinn
    Aug 1, 2014 at 19:36
  • \$\begingroup\$ Hmm weird. You might have forgotten to enable something / loaded a texture. Check this page, it has everything you need: goo.gl/GuD35y \$\endgroup\$
    – Basaa
    Aug 2, 2014 at 16:08
  • \$\begingroup\$ Got it fixed, part of the fix included this. Approved \$\endgroup\$
    – Rando Hinn
    Aug 3, 2014 at 8:13
  • \$\begingroup\$ @RandoHinn So what was the fix of the problem where you've got pieces of other texture? \$\endgroup\$ Aug 6, 2017 at 20:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .