I'm trying to make a simple game in LWJGL but no matter what I do I just get a black screen and it becomes unresponsive. Here is the code that opens the window:
package src;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import src.Wall.Pos;
import static org.lwjgl.opengl.GL11.*;
public class MyGame {
public void Loop()
{
Display.setResizable(false);
Display.setTitle("My Game");
try
{
Display.setDisplayMode(new DisplayMode(640, 480));
Display.create();
}
catch (LWJGLException e)
{
e.printStackTrace();
System.exit(0);
}
Wall.Load();
Wall wall = new Wall(500, 500, 30, Wall.Pos.Vertical);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight(), -1, 1);
glMatrixMode(GL_MODELVIEW);
Display.sync(60);
while(!Display.isCloseRequested())
{
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
boolean Up = Keyboard.isKeyDown(Keyboard.KEY_UP);
boolean Down = Keyboard.isKeyDown(Keyboard.KEY_DOWN);
boolean Left = Keyboard.isKeyDown(Keyboard.KEY_LEFT);
boolean Right = Keyboard.isKeyDown(Keyboard.KEY_RIGHT);
boolean Swap = Mouse.isButtonDown(0);
wall.RenderWall();
}
Display.destroy();
}
}
I don't know what I did wrong but does anyone know why nothing is working?