Hello. I’m new to Java 2d game programming with OpenGL, so I have to stick to tutorials becaus I don’t understand all of the correlations yet. I’ve allready successfully successfully implemented JBox2D in my game but I’ve got a problem:
I try to display text with the Slick library:
private UnicodeFont font;
Font fo = new Font("Times New Roman", Font.BOLD, 18);
font = new UnicodeFont(fo);
font.getEffects().add(new ColorEffect(Color.white));
font.addAsciiGlyphs();
try {
font.loadGlyphs();
} catch (SlickException e) {
e.printStackTrace();
}
and in the Draw method in the game loop:
font.drawString(0, 0, "Test");
This works fine, but the text is upside down. I know, that I can fix this by changing
GL11.glOrtho(0, GameSettings.resolutionX, 0, GameSettings.resolutionY, 1, -1);
to
GL11.glOrtho(0, GameSettings.resolutionX, GameSettings.resolutionY, 0, 1, -1);
in my openGL initialization.
But this does not help, because now the textures and physics are upside down. I can solve this by simply draw the textures upside down, but this does not help for the physics.
Thanks for your help.