I'm converting a java game to lwjgl and slick-utils. I've followed the slick2d examples for font loading/rendering but I found that the font shows as a solid box of color unless I add the following glBlendFunc code:
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
head_font.drawString( (float)(x + 20), (float)(y + 80), "Title Here", org.newdawn.slick.Color.green);
GL11.glDisable(GL11.GL_BLEND);
I've tried leaving this code as-is, I've tried leaving the blend function on, but any other drawing methods I have vanish when that blendFunc line is left in.
For example, here's a basic rectangle drawing method. The rect drawn here, only shows when I leave out the blend func. Is there a different blend func I need to constantly switch to?
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f( r_f, g_f, b_f, a_f );
GL11.glRecti(x1, y1, x2, y2);
GL11.glEnd();
GL11.glDisable(GL11.GL_BLEND);
Update: Setting the blendFunc back to default values for the drawRect method I have works, but I'm not sure yet if it's the right solution.
GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO);
(GL_ONE, GL_ZERO)
blend func is equivalent to no blending at all. Have you tried disabling blending after drawing the text, and leaving it turned off for drawing the rectangles? \$\endgroup\$