Thanks davedes and Longarmx!
Longarmx some questions, about that code you posted, could I just include that in the constructor?
Is
1 2 3 4
| GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); |
any different than
1 2 3 4
| glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, 1200, 800, 0, 1, -1); glOrtho(0, 1200, 800, 0, 1, -1); |
?
You could put it in the constructor if you really wanted to, but if you ever need to access your main class variable, you will have to do it through inheritance. I would personally just make it an initGL() method that is called in your main init() method. Saves a lot of confusion.
About your code, it is fine to not have the GL11. before everything. You just need to statically import GL11.
About the glOrtho though, I would still use the Display.width(), and Display.height() just so that it you don't have to worry about it later on if you want to change the size of the display.
The way you have it set up right now (glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 1, -1)), the coordinates are like they are in Java2D and such (with (0, 0) starting the the upper left hand corner). Unfortunately though, the mouse input doesn't change depending on your coordinate system. You can easily fix this by having a mouseY = Display.getHeight() - Mouse.getY();
I personally use glOrtho the way you are doing it just because I am used to it. You can use whatever you like though.
~Longarmx