public static void initDisplay() {

		// Get the original display mode (the display mode before the program is
		// run)
		origDisplayMode = Display.getDisplayMode();
		System.out.println("RacingApp.initDisplay(): Current display mode is: "
				+ origDisplayMode);

		try {
			// If the program settings indicate it to use the current display
			// mode,
			// use the original display mode, otherwise find a new one
			if (useCurrentDisplay) {
				displayMode = origDisplayMode;
			} else {
				// If the program cannot find a compatible display mode for the
				// program, output an error
				if ((displayMode = getDisplayMode(displayWidth, displayHeight,
						displayColourBits, displayFrequency)) == null
						&& (displayMode = getDisplayMode(1024, 768, 32, 60)) == null
						&& (displayMode = getDisplayMode(1024, 768, 16, 60)) == null
						&& (displayMode = getDisplayMode(
								origDisplayMode.getHeight(),
								origDisplayMode.getWidth(),
								origDisplayMode.getBitsPerPixel(),
								origDisplayMode.getFrequency())) == null) {
					System.out
							.println("KouchKarting.initDisplay() error: Could not find a "
									+ "compatible display mode!");
				}
			}
			// For debugging, output the current display mode and assign values
			// to the display setting variables
			System.out
					.println("RacingApp.initDisplay(): Setting display mode to "
							+ displayMode
							+ " with pixel depth = "
							+ depthBufferBits);
			Display.setDisplayMode(displayMode);
			displayWidth = displayMode.getWidth();
			displayHeight = displayMode.getHeight();
			displayColourBits = displayMode.getBitsPerPixel();
			displayFrequency = displayMode.getFrequency();
		}
		// Catches any exceptions thrown by setDisplayMode()
		catch (Exception exception) {
			System.err
					.println("RacingApp.initDisplay() failed to creat a display: "
							+ exception);
			System.exit(1);
		}

		// Create a new OpenGl window, if the window could not be created,
		// output an System.out.println and exit the program
		try {
			Display.setTitle(windowTitle);
			Display.setFullscreen(fullScreen);
			Display.setVSyncEnabled(vSyncEnabled);
			Display.create(new PixelFormat(0, depthBufferBits, 8));
		}
		// Catches any thrown excpetions by create() or setFullScreen()
		catch (Exception exception) {
			System.err
					.println("KouchKarting.initDisplay() failed to create OpenGL window: "
							+ exception);
			System.exit(1);
		}

		// If the aspect ratio is 0, use the default one
		if (aspectRatio == 0f) {
			aspectRatio = (float) displayMode.getWidth()
					/ (float) displayMode.getHeight();
		}

		// Calculate the size of the viewport
		viewportH = displayMode.getHeight();
		viewportW = (int) (displayMode.getHeight() * aspectRatio);
		if (viewportW > displayMode.getWidth()) {
			viewportW = displayMode.getWidth();
			viewportH = (int) (displayMode.getWidth() * (1 / aspectRatio));
		}

		// Centre the viewport in the window
		viewportX = (int) ((displayMode.getWidth() - viewportW) / 2);
		viewportY = (int) ((displayMode.getHeight() - viewportH) / 2);
	}