Add support for opengl versions > 3.2 in lwjgl2 renderer

accellbaker
Riccardo Balbo 6 years ago committed by GitHub
parent 7e11a6c0fe
commit a68d8b50e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 60
      jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglContext.java

@ -106,11 +106,61 @@ public abstract class LwjglContext implements JmeContext {
Display.getPixelScaleFactor()});
}
protected int[] getGLVersion(String renderer) {
int maj = -1, min = -1;
switch (settings.getRenderer()) {
case AppSettings.LWJGL_OPENGL2:
maj = 2;
min = 0;
break;
// case AppSettings.LWJGL_OPENGL30:
// maj=3;
// min=0;
// break;
case AppSettings.LWJGL_OPENGL3:
// case AppSettings.LWJGL_OPENGL32:
maj = 3;
min = 2;
break;
case AppSettings.LWJGL_OPENGL33:
maj = 3;
min = 3;
break;
case AppSettings.LWJGL_OPENGL4:
// case AppSettings.LWJGL_OPENGL40:
maj = 4;
min = 0;
break;
case AppSettings.LWJGL_OPENGL41:
maj = 4;
min = 1;
break;
case AppSettings.LWJGL_OPENGL42:
maj = 4;
min = 2;
break;
case AppSettings.LWJGL_OPENGL43:
maj = 4;
min = 3;
break;
case AppSettings.LWJGL_OPENGL44:
maj = 4;
min = 4;
break;
case AppSettings.LWJGL_OPENGL45:
maj = 4;
min = 5;
break;
}
return maj == -1 ? null : new int[] { maj, min };
}
protected ContextAttribs createContextAttribs() {
if (settings.getBoolean("GraphicsDebug") || settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)) {
int vers[] = getGLVersion(settings.getRenderer());
if (settings.getBoolean("GraphicsDebug") || (vers != null && vers[0] != 2)) {
ContextAttribs attr;
if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)) {
attr = new ContextAttribs(3, 2);
if (vers != null && vers[0] != 2) {
attr = new ContextAttribs(vers[0], vers[1]);
attr = attr.withProfileCore(true).withForwardCompatible(true).withProfileCompatibility(false);
} else {
attr = new ContextAttribs();
@ -204,8 +254,8 @@ public abstract class LwjglContext implements JmeContext {
+ "required for jMonkeyEngine");
}
if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL2)
|| settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)) {
int vers[] = getGLVersion(settings.getRenderer());
if (vers != null) {
GL gl = new LwjglGL();
GLExt glext = new LwjglGLExt();
GLFbo glfbo;

Loading…
Cancel
Save