Fixes #1251 - Support OpenGL3.1 on LWJGL2 and LWJGL3

This commit is contained in:
MeFisto94 2020-01-12 15:22:26 +01:00
parent 77c521fefa
commit 04e7bed5e7
4 changed files with 36 additions and 13 deletions

View File

@ -70,19 +70,6 @@ public final class AppSettings extends HashMap<String, Object> {
*/ */
public static final String LWJGL_OPENGL2 = "LWJGL-OpenGL2"; public static final String LWJGL_OPENGL2 = "LWJGL-OpenGL2";
/**
* Use LWJGL as the display system and force using the core OpenGL3.0 renderer.
* <p>
* If the underlying system does not support OpenGL3.0, then the context
* initialization will throw an exception. Note that currently jMonkeyEngine
* does not have any shaders that support OpenGL3.0 therefore this
* option is not useful.
* <p>
*
* @see AppSettings#setRenderer(java.lang.String)
*/
public static final String LWJGL_OPENGL30 = "LWJGL-OpenGL30";
/** /**
* Use LWJGL as the display system and force using the core OpenGL3.2 renderer. * Use LWJGL as the display system and force using the core OpenGL3.2 renderer.
* <p> * <p>
@ -99,6 +86,33 @@ public final class AppSettings extends HashMap<String, Object> {
@Deprecated @Deprecated
public static final String LWJGL_OPENGL3 = "LWJGL-OpenGL3"; public static final String LWJGL_OPENGL3 = "LWJGL-OpenGL3";
/**
* Use LWJGL as the display system and force using the core OpenGL3.0 renderer.
* <p>
* If the underlying system does not support OpenGL3.0, then the context
* initialization will throw an exception. Note that currently jMonkeyEngine
* does not have any shaders that support OpenGL3.0 therefore this
* option is not useful.
* <p>
*
* @see AppSettings#setRenderer(java.lang.String)
*/
public static final String LWJGL_OPENGL30 = "LWJGL-OpenGL30";
/**
* Use LWJGL as the display system and force using the core OpenGL3.1 renderer.
* <p>
* If the underlying system does not support OpenGL3.1, then the context
* initialization will throw an exception. Note that currently jMonkeyEngine
* does not have any shaders that support OpenGL3.0 therefore this
* option is not useful.
* <p>
*
* @see AppSettings#setRenderer(java.lang.String)
*/
public static final String LWJGL_OPENGL31 = "LWJGL-OpenGL31";
/** /**
* Use LWJGL as the display system and force using the core OpenGL3.2 renderer. * Use LWJGL as the display system and force using the core OpenGL3.2 renderer.
* <p> * <p>

View File

@ -117,6 +117,10 @@ public abstract class LwjglContext implements JmeContext {
maj = 3; maj = 3;
min = 0; min = 0;
break; break;
case AppSettings.LWJGL_OPENGL31:
maj = 3;
min = 1;
break;
case AppSettings.LWJGL_OPENGL32: case AppSettings.LWJGL_OPENGL32:
maj = 3; maj = 3;
min = 2; min = 2;

View File

@ -106,6 +106,7 @@ public abstract class LwjglContext implements JmeContext {
private static final Set<String> SUPPORTED_RENDERS = new HashSet<>(Arrays.asList( private static final Set<String> SUPPORTED_RENDERS = new HashSet<>(Arrays.asList(
AppSettings.LWJGL_OPENGL2, AppSettings.LWJGL_OPENGL2,
AppSettings.LWJGL_OPENGL30, AppSettings.LWJGL_OPENGL30,
AppSettings.LWJGL_OPENGL31,
AppSettings.LWJGL_OPENGL32, AppSettings.LWJGL_OPENGL32,
AppSettings.LWJGL_OPENGL33, AppSettings.LWJGL_OPENGL33,
AppSettings.LWJGL_OPENGL40, AppSettings.LWJGL_OPENGL40,

View File

@ -80,6 +80,10 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
}); });
RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL31, () -> {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
});
RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL32, () -> { RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL32, () -> {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);