Drawing text with Slick

I've been trying to draw a text to the display using Slick. However, when ever I draw the TrueTypeFont to the screen, it draws it reversed upside down and also, it makes the whole display turn black.

This is only a piece of the entire game code, I think this is enough to explain the problem though. I'm new to LWJGL and Slick so this is probably a stupid question.

public Game(String name, int width, int height)
{
this.name = name;
this.width = width;
this.height = height;

try {
Display.setDisplayMode(new DisplayMode(width, height));
Display.setTitle(name + " " + version);
Display.setResizable(true);

Display.create();
} catch (LWJGLException e) {
e.printStackTrace();

Display.destroy();
return;
}

TrueTypeFont font;
Font awtFont = new Font("Arial", Font.PLAIN, 24);
font = new TrueTypeFont(awtFont, false);

Player player = new Player(this, 32, 32);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

while(!Display.isCloseRequested())
{
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glOrtho(0, width, 0, height, -1, 1);
glMatrixMode(GL_MODELVIEW);

drawBackground();

player.update();
player.draw();
font.drawString(50, 50, "Platform");

Display.update();
Display.sync(60);
}

Display.destroy();
}


Edit: After doing what @Katu said, I changed glOrtho(0, width, 0, height, -1, 1); to glOrtho(0, width, height, 0, -1, 1);. The text is not reversed upside down, but the black screen is still there.

The screen should look something like this. (NOTE: It's an edited image)

Change

glOrtho(0, width, 0, height, -1, 1);


To this:

glOrtho(0, width, height, 0, -1, 1);


A quick little understanding about why your font wasn't working (if you don't already know), glOrtho is called like this:

glOrtho(double left, double right, double bottom, double top, double zNear, double zFar).


This being said, you had the bottom set to 0 where it should have been set to the display's height or a custom bottom if necessary and that is the reason why the text was facing the top of the screen or rather, being drawn up-side down.

I collected this answer from these:

• Thanks, that solved the main problem. Now it's showing a black screen with a text saying "Platform" when it's suppose to draw the player, the background, and the text. Here's a screenshot. – Vicente Bermúdez May 27 '15 at 16:03
• @VicenteBermúdez Test if this helps -> glEnable(GL_TEXTURE_2D); ( Add it to near glEnable(GL_BLEND); ) – Katu May 27 '15 at 16:15
• I tried that and it's still remains the same. It should look something like this – Vicente Bermúdez May 27 '15 at 16:22
• @VicenteBermúdez Then try glBindTexture (GL_TEXTURE_2D,0) If this wont work, I'm out of bullets – Katu May 27 '15 at 18:20
• That makes it draw a white rectangle instead of a text. The background and player is working now but the text isn't. Thanks though :) – Vicente Bermúdez May 27 '15 at 18:44