Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions jme3-core/src/main/java/com/jme3/system/AppSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ 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>
Expand All @@ -80,10 +93,26 @@ public final class AppSettings extends HashMap<String, Object> {
* <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>
* 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.
* <p>
Expand All @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions jme3-desktop/src/main/java/com/jme3/system/AWTContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void setWidth(final int width) {
*/
protected AppSettings createSettings() {
final AppSettings settings = new AppSettings(true);
settings.setRenderer(AppSettings.LWJGL_OPENGL3);
settings.setRenderer(AppSettings.LWJGL_OPENGL32);
return settings;
}

Expand All @@ -145,7 +145,7 @@ public Type getType() {
@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);
}

Expand Down
14 changes: 6 additions & 8 deletions jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,19 @@ protected int[] getGLVersion(String renderer) {
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;
case AppSettings.LWJGL_OPENGL33:
maj = 3;
min = 3;
break;
case AppSettings.LWJGL_OPENGL4:
// case AppSettings.LWJGL_OPENGL40:
case AppSettings.LWJGL_OPENGL40:
maj = 4;
min = 0;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,19 @@ 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);
});
RENDER_CONFIGS.put(AppSettings.LWJGL_OPENGL33, () -> {
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);
});
Expand Down
4 changes: 2 additions & 2 deletions jme3-vr/src/main/java/com/jme3/app/VRApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -763,8 +763,8 @@ public void start() {

// 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ protected int getNumSamplesToUse() {
}

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;
Expand Down