#1097-Fixed inconsistent OpenGL version constants (#1099)
This commit is contained in:
parent
cf45e66d11
commit
930090dfa0
@ -70,6 +70,35 @@ public final class AppSettings extends HashMap<String, Object> {
|
||||
*/
|
||||
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.
|
||||
* <p>
|
||||
* If the underlying system does not support OpenGL3.2, then the context
|
||||
* initialization will throw an exception. Note that currently jMonkeyEngine
|
||||
* does not have any shaders that support OpenGL3.2 therefore this
|
||||
* option is not useful.
|
||||
* <p>
|
||||
* Note: OpenGL 3.2 is used to give 3.x support to Mac users.
|
||||
*
|
||||
* @deprecated Previously meant 3.2, use LWJGL_OPENGL32 or LWJGL_OPENGL30
|
||||
* @see AppSettings#setRenderer(java.lang.String)
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String LWJGL_OPENGL3 = "LWJGL-OpenGL3";
|
||||
|
||||
/**
|
||||
* Use LWJGL as the display system and force using the core OpenGL3.2 renderer.
|
||||
* <p>
|
||||
@ -82,7 +111,7 @@ public final class AppSettings extends HashMap<String, Object> {
|
||||
*
|
||||
* @see AppSettings#setRenderer(java.lang.String)
|
||||
*/
|
||||
public static final String LWJGL_OPENGL3 = "LWJGL-OpenGL3";
|
||||
public static final String LWJGL_OPENGL32 = LWJGL_OPENGL3;
|
||||
|
||||
/**
|
||||
* Use LWJGL as the display system and force using the OpenGL3.3 renderer.
|
||||
@ -100,10 +129,22 @@ public final class AppSettings extends HashMap<String, Object> {
|
||||
* If the underlying system does not support OpenGL4.0, then the context
|
||||
* initialization will throw an exception.
|
||||
*
|
||||
* @deprecated Use LWJGL_OPENGL40
|
||||
* @see AppSettings#setRenderer(java.lang.String)
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String LWJGL_OPENGL4 = "LWJGL-OpenGL4";
|
||||
|
||||
/**
|
||||
* Use LWJGL as the display system and force using the OpenGL4.0 renderer.
|
||||
* <p>
|
||||
* If the underlying system does not support OpenGL4.0, then the context
|
||||
* initialization will throw an exception.
|
||||
*
|
||||
* @see AppSettings#setRenderer(java.lang.String)
|
||||
*/
|
||||
public static final String LWJGL_OPENGL40 = LWJGL_OPENGL4;
|
||||
|
||||
/**
|
||||
* Use LWJGL as the display system and force using the OpenGL4.1 renderer.
|
||||
* <p>
|
||||
|
@ -126,7 +126,7 @@ public class AWTContext implements JmeContext {
|
||||
*/
|
||||
protected AppSettings createSettings() {
|
||||
final AppSettings settings = new AppSettings(true);
|
||||
settings.setRenderer(AppSettings.LWJGL_OPENGL3);
|
||||
settings.setRenderer(AppSettings.LWJGL_OPENGL32);
|
||||
return settings;
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ public class AWTContext implements JmeContext {
|
||||
@Override
|
||||
public void setSettings(AppSettings settings) {
|
||||
this.settings.copyFrom(settings);
|
||||
this.settings.setRenderer(AppSettings.LWJGL_OPENGL3);
|
||||
this.settings.setRenderer(AppSettings.LWJGL_OPENGL32);
|
||||
this.backgroundContext.setSettings(settings);
|
||||
}
|
||||
|
||||
|
@ -113,12 +113,11 @@ public abstract class LwjglContext implements JmeContext {
|
||||
maj = 2;
|
||||
min = 0;
|
||||
break;
|
||||
// case AppSettings.LWJGL_OPENGL30:
|
||||
// maj=3;
|
||||
// min=0;
|
||||
// break;
|
||||
case AppSettings.LWJGL_OPENGL3:
|
||||
// case AppSettings.LWJGL_OPENGL32:
|
||||
case AppSettings.LWJGL_OPENGL30:
|
||||
maj = 3;
|
||||
min = 0;
|
||||
break;
|
||||
case AppSettings.LWJGL_OPENGL32:
|
||||
maj = 3;
|
||||
min = 2;
|
||||
break;
|
||||
@ -126,8 +125,7 @@ public abstract class LwjglContext implements JmeContext {
|
||||
maj = 3;
|
||||
min = 3;
|
||||
break;
|
||||
case AppSettings.LWJGL_OPENGL4:
|
||||
// case AppSettings.LWJGL_OPENGL40:
|
||||
case AppSettings.LWJGL_OPENGL40:
|
||||
maj = 4;
|
||||
min = 0;
|
||||
break;
|
||||
|
@ -105,9 +105,10 @@ public abstract class LwjglContext implements JmeContext {
|
||||
|
||||
private static final Set<String> SUPPORTED_RENDERS = new HashSet<>(Arrays.asList(
|
||||
AppSettings.LWJGL_OPENGL2,
|
||||
AppSettings.LWJGL_OPENGL3,
|
||||
AppSettings.LWJGL_OPENGL30,
|
||||
AppSettings.LWJGL_OPENGL32,
|
||||
AppSettings.LWJGL_OPENGL33,
|
||||
AppSettings.LWJGL_OPENGL4,
|
||||
AppSettings.LWJGL_OPENGL40,
|
||||
AppSettings.LWJGL_OPENGL41,
|
||||
AppSettings.LWJGL_OPENGL42,
|
||||
AppSettings.LWJGL_OPENGL43,
|
||||
|
@ -76,7 +76,11 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
|
||||
private static final Map<String, Runnable> RENDER_CONFIGS = new HashMap<>();
|
||||
|
||||
static {
|
||||
RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL3, () -> {
|
||||
RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL30, () -> {
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||
});
|
||||
RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL32, () -> {
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
||||
});
|
||||
@ -84,7 +88,7 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||
});
|
||||
RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL4, () -> {
|
||||
RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL40, () -> {
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
||||
});
|
||||
|
@ -763,8 +763,8 @@ public abstract class VRApplication implements Application, SystemListener {
|
||||
|
||||
// set opengl mode
|
||||
if( tryOpenGL3 ) {
|
||||
logger.config("Using LWJGL OpenGL 3 renderer.");
|
||||
settings.setRenderer(AppSettings.LWJGL_OPENGL3);
|
||||
logger.config("Using LWJGL OpenGL 3.2 renderer.");
|
||||
settings.setRenderer(AppSettings.LWJGL_OPENGL32);
|
||||
} else {
|
||||
logger.config("Using LWJGL OpenGL 2 renderer.");
|
||||
settings.setRenderer(AppSettings.LWJGL_OPENGL2);
|
||||
|
@ -147,14 +147,14 @@ public abstract class LwjglContextVR implements JmeContext {
|
||||
}
|
||||
|
||||
protected void initContextFirstTime() {
|
||||
final GLCapabilities capabilities = createCapabilities(settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3));
|
||||
final GLCapabilities capabilities = createCapabilities(settings.getRenderer().equals(AppSettings.LWJGL_OPENGL32));
|
||||
|
||||
if (!capabilities.OpenGL20) {
|
||||
throw new RendererException("OpenGL 2.0 or higher is required for jMonkeyEngine");
|
||||
}
|
||||
|
||||
if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL2)
|
||||
|| settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)) {
|
||||
|| settings.getRenderer().equals(AppSettings.LWJGL_OPENGL32)) {
|
||||
GL gl = new LwjglGL();
|
||||
GLExt glext = new LwjglGLExt();
|
||||
GLFbo glfbo;
|
||||
|
Loading…
x
Reference in New Issue
Block a user