Allows to choose between the forward compatible profile and the backward compatible profile in the JOGL backend
This commit is contained in:
parent
f38ea1e3e2
commit
ce86a3e555
@ -112,13 +112,22 @@ public final class AppSettings extends HashMap<String, Object> {
|
|||||||
public static final String ANDROID_OPENAL_SOFT = "OpenAL_SOFT";
|
public static final String ANDROID_OPENAL_SOFT = "OpenAL_SOFT";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use JogAmp's JOGL as the display system
|
* Use JogAmp's JOGL as the display system, with the OpenGL forward compatible profile
|
||||||
* <p>
|
* <p>
|
||||||
* N.B: This backend is EXPERIMENTAL
|
* N.B: This backend is EXPERIMENTAL
|
||||||
*
|
*
|
||||||
* @see AppSettings#setRenderer(java.lang.String)
|
* @see AppSettings#setRenderer(java.lang.String)
|
||||||
*/
|
*/
|
||||||
public static final String JOGL = "JOGL";
|
public static final String JOGL_OPENGL_FORWARD_COMPATIBLE = "JOGL_OPENGL_FORWARD_COMPATIBLE";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use JogAmp's JOGL as the display system with the backward compatible profile
|
||||||
|
* <p>
|
||||||
|
* N.B: This backend is EXPERIMENTAL
|
||||||
|
*
|
||||||
|
* @see AppSettings#setRenderer(java.lang.String)
|
||||||
|
*/
|
||||||
|
public static final String JOGL_OPENGL_BACKWARD_COMPATIBLE = "JOGL_OPENGL_BACKWARD_COMPATIBLE";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use JogAmp's JOAL as the display system
|
* Use JogAmp's JOAL as the display system
|
||||||
|
@ -37,6 +37,7 @@ import com.jme3.input.MouseInput;
|
|||||||
import com.jme3.input.TouchInput;
|
import com.jme3.input.TouchInput;
|
||||||
import com.jme3.input.awt.AwtKeyInput;
|
import com.jme3.input.awt.AwtKeyInput;
|
||||||
import com.jme3.input.awt.AwtMouseInput;
|
import com.jme3.input.awt.AwtMouseInput;
|
||||||
|
import com.jme3.system.AppSettings;
|
||||||
import com.jogamp.opengl.util.Animator;
|
import com.jogamp.opengl.util.Animator;
|
||||||
import com.jogamp.opengl.util.AnimatorBase;
|
import com.jogamp.opengl.util.AnimatorBase;
|
||||||
import com.jogamp.opengl.util.FPSAnimator;
|
import com.jogamp.opengl.util.FPSAnimator;
|
||||||
@ -80,9 +81,13 @@ public abstract class JoglAbstractDisplay extends JoglContext implements GLEvent
|
|||||||
|
|
||||||
device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
|
device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
|
||||||
|
|
||||||
//FIXME use the settings to know whether to use the max programmable profile
|
GLCapabilities caps;
|
||||||
//then call GLProfile.getMaxProgrammable(true);
|
if (settings.getRenderer().equals(AppSettings.JOGL_OPENGL_FORWARD_COMPATIBLE)) {
|
||||||
GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true));
|
caps = new GLCapabilities(GLProfile.getMaxProgrammable(true));
|
||||||
|
} else {
|
||||||
|
caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true));
|
||||||
|
}
|
||||||
|
|
||||||
caps.setHardwareAccelerated(true);
|
caps.setHardwareAccelerated(true);
|
||||||
caps.setDoubleBuffered(true);
|
caps.setDoubleBuffered(true);
|
||||||
caps.setStencilBits(settings.getStencilBits());
|
caps.setStencilBits(settings.getStencilBits());
|
||||||
|
@ -167,7 +167,7 @@ public abstract class JoglContext implements JmeContext {
|
|||||||
"required for jMonkeyEngine");
|
"required for jMonkeyEngine");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.getRenderer().equals("JOGL")) {
|
if (settings.getRenderer().startsWith("JOGL")) {
|
||||||
com.jme3.renderer.opengl.GL gl = new JoglGL();
|
com.jme3.renderer.opengl.GL gl = new JoglGL();
|
||||||
GLExt glext = new JoglGLExt();
|
GLExt glext = new JoglGLExt();
|
||||||
GLFbo glfbo = new JoglGLFbo();
|
GLFbo glfbo = new JoglGLFbo();
|
||||||
|
@ -37,6 +37,7 @@ import com.jme3.input.MouseInput;
|
|||||||
import com.jme3.input.TouchInput;
|
import com.jme3.input.TouchInput;
|
||||||
import com.jme3.input.jogl.NewtKeyInput;
|
import com.jme3.input.jogl.NewtKeyInput;
|
||||||
import com.jme3.input.jogl.NewtMouseInput;
|
import com.jme3.input.jogl.NewtMouseInput;
|
||||||
|
import com.jme3.system.AppSettings;
|
||||||
import com.jogamp.newt.opengl.GLWindow;
|
import com.jogamp.newt.opengl.GLWindow;
|
||||||
import com.jogamp.opengl.util.Animator;
|
import com.jogamp.opengl.util.Animator;
|
||||||
import com.jogamp.opengl.util.AnimatorBase;
|
import com.jogamp.opengl.util.AnimatorBase;
|
||||||
@ -73,10 +74,12 @@ public abstract class JoglNewtAbstractDisplay extends JoglContext implements GLE
|
|||||||
|
|
||||||
protected void initGLCanvas() {
|
protected void initGLCanvas() {
|
||||||
loadNatives();
|
loadNatives();
|
||||||
//FIXME use the settings to know whether to use the max programmable profile
|
GLCapabilities caps;
|
||||||
//then call GLProfile.getMaxProgrammable(true);
|
if (settings.getRenderer().equals(AppSettings.JOGL_OPENGL_FORWARD_COMPATIBLE)) {
|
||||||
//FIXME use the default profile only on embedded devices
|
caps = new GLCapabilities(GLProfile.getMaxProgrammable(true));
|
||||||
GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
|
} else {
|
||||||
|
caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true));
|
||||||
|
}
|
||||||
caps.setHardwareAccelerated(true);
|
caps.setHardwareAccelerated(true);
|
||||||
caps.setDoubleBuffered(true);
|
caps.setDoubleBuffered(true);
|
||||||
caps.setStencilBits(settings.getStencilBits());
|
caps.setStencilBits(settings.getStencilBits());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user