Straight out of Super Elvis Game.init():
if (!windowed) {
try {
DisplayMode[] dm = Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 85);
Display.setDisplayMode(dm, new String[] {
"width="+WIDTH,
"height="+HEIGHT,
"freq="+((int)FRAMERATE),
"bpp="+org.lwjgl.Display.getDepth()
});
} catch (Exception e) {
e.printStackTrace(System.err);
windowed = true;
}
}
try {
int width, height;
if (windowed) {
width = java.lang.Math.min(org.lwjgl.Display.getWidth(), WIDTH);
height = java.lang.Math.min(org.lwjgl.Display.getHeight(), HEIGHT);
Window.create(GAME_TITLE, 0, 0, width, height, 16, 0, 0, 0, 0);
} else {
width = org.lwjgl.Display.getWidth();
height = org.lwjgl.Display.getHeight();
try {
Window.create(GAME_TITLE, 16, 0, 0, 0, 0);
} catch (Exception e) {
width = java.lang.Math.min(org.lwjgl.Display.getWidth(), WIDTH);
height = java.lang.Math.min(org.lwjgl.Display.getHeight(), HEIGHT);
Window.create(GAME_TITLE, 0, 0, width, height, 16, 0, 0, 0, 0);
}
}
NvidiaInitializer.initialize(2048 * 2048, 0);
} catch (Exception e) {
e.printStackTrace();
cleanup();
Sys.alert(
GAME_TITLE,
"You need an OpenGL compatible graphics card to run "
+ GAME_TITLE
+ ". You may have a suitable graphics card but not have OpenGL drivers. Please contact "
+ EMAIL_ADDRESS
+ " for assistance or visit our website if you need help finding OpenGL drivers for your graphics card.");
Support.doSupport("opengl");
exit();
}
Cas 