private void createDisplayPixelFormat () {
try {
if (config.useGL30) {
ContextAttribs context = new ContextAttribs(3, 2).withForwardCompatible(false).withProfileCore(true);
try {
Display.create(new PixelFormat(config.r + config.g + config.b, config.a, config.depth, config.stencil,
config.samples));
} catch (Exception e) {
Display.create(new PixelFormat(config.r + config.g + config.b, config.a, config.depth, config.stencil,
config.samples));
System.out.println("LwjglGraphics: couldn't create OpenGL 3.2+ core profile context");
}
System.out.println("LwjglGraphics: created OpenGL 3.2+ core profile context. This is experimental!");
} else {
Display
.create(new PixelFormat(config.r + config.g + config.b, config.a, config.depth, config.stencil, config.samples));
}
bufferFormat = new BufferFormat(config.r, config.g, config.b, config.a, config.depth, config.stencil, config.samples,
false);
} catch (Exception ex) {
Display.destroy();
try {
Thread.sleep(200);
} catch (InterruptedException ignored) {
}
try {
Display.create(new PixelFormat(0, 16, 8));
if (getDesktopDisplayMode().bitsPerPixel == 16) {
bufferFormat = new BufferFormat(5, 6, 5, 0, 16, 8, 0, false);
}
if (getDesktopDisplayMode().bitsPerPixel == 24) {
bufferFormat = new BufferFormat(8, 8, 8, 0, 16, 8, 0, false);
}
if (getDesktopDisplayMode().bitsPerPixel == 32) {
bufferFormat = new BufferFormat(8, 8, 8, 8, 16, 8, 0, false);
}
} catch (Exception ex2) {
Display.destroy();
try {
Thread.sleep(200);
} catch (InterruptedException ignored) {
}
try {
Display.create(new PixelFormat());
} catch (Exception ex3) {
if (ex3.getMessage().contains("Pixel format not accelerated")) {
if (!softwareMode && config.allowSoftwareMode) {
softwareMode = true;
System.setProperty("org.lwjgl.opengl.Display.allowSoftwareOpenGL", "true");