Box instead of Text

Hello, as the title says, when I render text it shows up as a red box instead of text. Here is my code:

public void render3D(){
		/* For some reason, needs commenting for camera to work :p */
		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
		resourceManager.getTextureManager().loadTextureSheet("resources/textures/terrain.png", true);
		
		BlockRenderer.renderBlock(Block.DIRT, 0f, 0f, 0f);
		BlockRenderer.renderWireframeBlock(Block.DIRT, 0f, 1f, 1f);
		
		setOrthoOn();
	    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
	    Color.white.bind();
	    
	    _font.drawString(100, 25, "Hello world!", Color.red);
		setOrthoOff();
	}

	
	public static Player getPlayerObject(){
		return p;
	}
	
	public static void setOrthoOn()
	{
	        // prepare to render in 2D
	        GL11.glDisable(GL11.GL_DEPTH_TEST);             // so 2D stuff stays on top of 3D scene
	        GL11.glMatrixMode(GL11.GL_PROJECTION);
	        GL11.glPushMatrix();                            // preserve perspective view
	        GL11.glLoadIdentity();                          // clear the perspective matrix
	        GL11.glOrtho(0, Binder.getDisplayMode().getWidth(), Binder.getDisplayMode().getHeight(), 0,-1,1);  // turn on 2D
	        GL11.glMatrixMode(GL11.GL_MODELVIEW);
	        GL11.glPushMatrix();                // Preserve the Modelview Matrix
	        GL11.glLoadIdentity();              // clear the Modelview Matrix
	}
	 
	public static void setOrthoOff()
	{
	        // restore the original positions and views
	        GL11.glMatrixMode(GL11.GL_PROJECTION);
	        GL11.glPopMatrix();
	        GL11.glMatrixMode(GL11.GL_MODELVIEW);
	        GL11.glPopMatrix();
	        GL11.glEnable(GL11.GL_DEPTH_TEST);      // turn Depth Testing back on
	}
Thanks for any pointers!

Is blending enabled?

GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

I got the same problem last week and my sources of error were two things:

  • I didn’t initialized the TTFont correct
  • I had to enable GL_TEXTURE_2D before I render the string and disable it afterwards.

Here is an example of my render method:


	public static void string(float x, float y, String text, float rotation, int color, float alpha, TrueTypeFont ttFont) {

		float r = getRedFromHex(color);
		float g = getGreenFromHex(color);
		float b = getBlueFromHex(color);

		glEnable(GL_TEXTURE_2D);
		glPushMatrix();
		{
			glTranslatef(x, y, 0);
			glRotatef(rotation, 0, 0, 1);
			ttFont.drawString(0, 0, text, new Color(r,g,b,alpha));
		}
		glPopMatrix();
		glDisable(GL_TEXTURE_2D);
	}