#1097-Fixed inconsistent OpenGL version constants (#1099)

accellbaker
Lou H 6 years ago committed by Riccardo Balbo
parent cf45e66d11
commit 930090dfa0
  1. 41
      jme3-core/src/main/java/com/jme3/system/AppSettings.java
  2. 4
      jme3-desktop/src/main/java/com/jme3/system/AWTContext.java
  3. 14
      jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglContext.java
  4. 5
      jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java
  5. 8
      jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java
  6. 4
      jme3-vr/src/main/java/com/jme3/app/VRApplication.java
  7. 4
      jme3-vr/src/main/java/com/jme3/system/lwjgl/LwjglContextVR.java

@ -70,6 +70,19 @@ 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>
@ -80,10 +93,26 @@ public final class AppSettings extends HashMap<String, Object> {
* <p> * <p>
* Note: OpenGL 3.2 is used to give 3.x support to Mac users. * 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) * @see AppSettings#setRenderer(java.lang.String)
*/ */
@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.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.
*
* @see AppSettings#setRenderer(java.lang.String)
*/
public static final String LWJGL_OPENGL32 = LWJGL_OPENGL3;
/** /**
* Use LWJGL as the display system and force using the OpenGL3.3 renderer. * Use LWJGL as the display system and force using the OpenGL3.3 renderer.
* <p> * <p>
@ -100,10 +129,22 @@ public final class AppSettings extends HashMap<String, Object> {
* If the underlying system does not support OpenGL4.0, then the context * If the underlying system does not support OpenGL4.0, then the context
* initialization will throw an exception. * initialization will throw an exception.
* *
* @deprecated Use LWJGL_OPENGL40
* @see AppSettings#setRenderer(java.lang.String) * @see AppSettings#setRenderer(java.lang.String)
*/ */
@Deprecated
public static final String LWJGL_OPENGL4 = "LWJGL-OpenGL4"; 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. * Use LWJGL as the display system and force using the OpenGL4.1 renderer.
* <p> * <p>

@ -126,7 +126,7 @@ public class AWTContext implements JmeContext {
*/ */
protected AppSettings createSettings() { protected AppSettings createSettings() {
final AppSettings settings = new AppSettings(true); final AppSettings settings = new AppSettings(true);
settings.setRenderer(AppSettings.LWJGL_OPENGL3); settings.setRenderer(AppSettings.LWJGL_OPENGL32);
return settings; return settings;
} }
@ -145,7 +145,7 @@ public class AWTContext implements JmeContext {
@Override @Override
public void setSettings(AppSettings settings) { public void setSettings(AppSettings settings) {
this.settings.copyFrom(settings); this.settings.copyFrom(settings);
this.settings.setRenderer(AppSettings.LWJGL_OPENGL3); this.settings.setRenderer(AppSettings.LWJGL_OPENGL32);
this.backgroundContext.setSettings(settings); this.backgroundContext.setSettings(settings);
} }

@ -113,12 +113,11 @@ public abstract class LwjglContext implements JmeContext {
maj = 2; maj = 2;
min = 0; min = 0;
break; break;
// case AppSettings.LWJGL_OPENGL30: case AppSettings.LWJGL_OPENGL30:
// maj=3; maj = 3;
// min=0; min = 0;
// break; break;
case AppSettings.LWJGL_OPENGL3: case AppSettings.LWJGL_OPENGL32:
// case AppSettings.LWJGL_OPENGL32:
maj = 3; maj = 3;
min = 2; min = 2;
break; break;
@ -126,8 +125,7 @@ public abstract class LwjglContext implements JmeContext {
maj = 3; maj = 3;
min = 3; min = 3;
break; break;
case AppSettings.LWJGL_OPENGL4: case AppSettings.LWJGL_OPENGL40:
// case AppSettings.LWJGL_OPENGL40:
maj = 4; maj = 4;
min = 0; min = 0;
break; break;

@ -105,9 +105,10 @@ 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_OPENGL3, AppSettings.LWJGL_OPENGL30,
AppSettings.LWJGL_OPENGL32,
AppSettings.LWJGL_OPENGL33, AppSettings.LWJGL_OPENGL33,
AppSettings.LWJGL_OPENGL4, AppSettings.LWJGL_OPENGL40,
AppSettings.LWJGL_OPENGL41, AppSettings.LWJGL_OPENGL41,
AppSettings.LWJGL_OPENGL42, AppSettings.LWJGL_OPENGL42,
AppSettings.LWJGL_OPENGL43, 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<>(); private static final Map<String, Runnable> RENDER_CONFIGS = new HashMap<>();
static { 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_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); 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_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 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_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
}); });

@ -763,8 +763,8 @@ public abstract class VRApplication implements Application, SystemListener {
// set opengl mode // set opengl mode
if( tryOpenGL3 ) { if( tryOpenGL3 ) {
logger.config("Using LWJGL OpenGL 3 renderer."); logger.config("Using LWJGL OpenGL 3.2 renderer.");
settings.setRenderer(AppSettings.LWJGL_OPENGL3); settings.setRenderer(AppSettings.LWJGL_OPENGL32);
} else { } else {
logger.config("Using LWJGL OpenGL 2 renderer."); logger.config("Using LWJGL OpenGL 2 renderer.");
settings.setRenderer(AppSettings.LWJGL_OPENGL2); settings.setRenderer(AppSettings.LWJGL_OPENGL2);

@ -147,14 +147,14 @@ public abstract class LwjglContextVR implements JmeContext {
} }
protected void initContextFirstTime() { 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) { if (!capabilities.OpenGL20) {
throw new RendererException("OpenGL 2.0 or higher is required for jMonkeyEngine"); throw new RendererException("OpenGL 2.0 or higher is required for jMonkeyEngine");
} }
if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL2) if (settings.getRenderer().equals(AppSettings.LWJGL_OPENGL2)
|| settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3)) { || settings.getRenderer().equals(AppSettings.LWJGL_OPENGL32)) {
GL gl = new LwjglGL(); GL gl = new LwjglGL();
GLExt glext = new LwjglGLExt(); GLExt glext = new LwjglGLExt();
GLFbo glfbo; GLFbo glfbo;

Loading…
Cancel
Save