aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/render/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jake2/render/opengl')
-rw-r--r--src/jake2/render/opengl/DummyGL.java2
-rw-r--r--src/jake2/render/opengl/JoglES1Driver.java14
-rw-r--r--src/jake2/render/opengl/JoglES2Driver.java14
-rw-r--r--src/jake2/render/opengl/JoglGL2Driver.java13
-rw-r--r--src/jake2/render/opengl/JoglGL2ES1.java5
-rw-r--r--src/jake2/render/opengl/NEWTWin.java20
6 files changed, 55 insertions, 13 deletions
diff --git a/src/jake2/render/opengl/DummyGL.java b/src/jake2/render/opengl/DummyGL.java
index b7d4c58..b7827e4 100644
--- a/src/jake2/render/opengl/DummyGL.java
+++ b/src/jake2/render/opengl/DummyGL.java
@@ -139,7 +139,7 @@ public class DummyGL implements QGL {
public String glGetString(int name) {
switch (name) {
case GL_EXTENSIONS:
- return "GL_ARB_multitexture";
+ return "GL_ARB_multitexture GL_EXT_point_parameters";
case GL_VERSION:
return "2.0.0 Dummy";
case GL_VENDOR:
diff --git a/src/jake2/render/opengl/JoglES1Driver.java b/src/jake2/render/opengl/JoglES1Driver.java
index be3a9fd..64d3790 100644
--- a/src/jake2/render/opengl/JoglES1Driver.java
+++ b/src/jake2/render/opengl/JoglES1Driver.java
@@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package jake2.render.opengl;
+import jake2.game.cvar_t;
+import jake2.qcommon.Cvar;
import jake2.qcommon.xcommand_t;
import jake2.render.Base;
@@ -38,8 +40,16 @@ import com.jogamp.newt.ScreenMode;
*/
public abstract class JoglES1Driver extends JoglGL2ES1 implements GLDriver {
- // protected static GLProfile glp = GLProfile.get(GLProfile.GLES1); // exception if n/a is desired
- protected static GLProfile glp = GLProfile.get(GLProfile.GL2ES1); // exception if n/a is desired
+ protected static final GLProfile glp;
+ static {
+ // exception if GLProfile is n/a is desired
+ cvar_t v = Cvar.Get("jogl_gl2es1", "0", 0);
+ if( v.value != 0f ) {
+ glp = GLProfile.getGL2ES1();
+ } else {
+ glp = GLProfile.get(GLProfile.GLES1);
+ }
+ }
protected JoglES1Driver() {
super(true);
diff --git a/src/jake2/render/opengl/JoglES2Driver.java b/src/jake2/render/opengl/JoglES2Driver.java
index edfe8b2..b6a0a62 100644
--- a/src/jake2/render/opengl/JoglES2Driver.java
+++ b/src/jake2/render/opengl/JoglES2Driver.java
@@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package jake2.render.opengl;
+import jake2.game.cvar_t;
+import jake2.qcommon.Cvar;
import jake2.qcommon.xcommand_t;
import jake2.render.Base;
@@ -40,8 +42,16 @@ import com.jogamp.opengl.util.glsl.fixedfunc.ShaderSelectionMode;
*/
public abstract class JoglES2Driver extends JoglGL2ES1 implements GLDriver {
- // protected static GLProfile glp = GLProfile.get(GLProfile.GLES2); // exception if n/a is desired
- protected static GLProfile glp = GLProfile.getGL2ES2(); // exception if n/a is desired
+ protected static final GLProfile glp;
+ static {
+ // exception if GLProfile is n/a is desired
+ cvar_t v = Cvar.Get("jogl_gl2es2", "0", 0);
+ if( v.value != 0f ) {
+ glp = GLProfile.getGL2ES2();
+ } else {
+ glp = GLProfile.get(GLProfile.GLES2);
+ }
+ }
// protected static final ShaderSelectionMode shaderSelectionMode = ShaderSelectionMode.AUTO;
protected static final ShaderSelectionMode shaderSelectionMode = ShaderSelectionMode.COLOR_TEXTURE2;
diff --git a/src/jake2/render/opengl/JoglGL2Driver.java b/src/jake2/render/opengl/JoglGL2Driver.java
index 2dd5710..c2ca450 100644
--- a/src/jake2/render/opengl/JoglGL2Driver.java
+++ b/src/jake2/render/opengl/JoglGL2Driver.java
@@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
package jake2.render.opengl;
+import jake2.game.cvar_t;
+import jake2.qcommon.Cvar;
import jake2.qcommon.xcommand_t;
import jake2.render.Base;
@@ -38,7 +40,16 @@ import com.jogamp.newt.ScreenMode;
*/
public abstract class JoglGL2Driver extends JoglGL2ES1 implements GLDriver {
- protected static GLProfile glp = GLProfile.get(GLProfile.GL2); // exception if n/a is desired
+ protected static final GLProfile glp;
+ static {
+ // exception if GLProfile is n/a is desired
+ cvar_t v = Cvar.Get("jogl_gl2", "1", 0);
+ if( v.value != 0f ) {
+ glp = GLProfile.get(GLProfile.GL2);
+ } else {
+ throw new GLException("GL2 is disabled");
+ }
+ }
protected JoglGL2Driver() {
super(true);
diff --git a/src/jake2/render/opengl/JoglGL2ES1.java b/src/jake2/render/opengl/JoglGL2ES1.java
index a183f2f..e560bac 100644
--- a/src/jake2/render/opengl/JoglGL2ES1.java
+++ b/src/jake2/render/opengl/JoglGL2ES1.java
@@ -1,9 +1,10 @@
package jake2.render.opengl;
-
import java.nio.*;
-import javax.media.opengl.*;
+import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
+import javax.media.opengl.GLException;
import com.jogamp.opengl.util.ImmModeSink;
diff --git a/src/jake2/render/opengl/NEWTWin.java b/src/jake2/render/opengl/NEWTWin.java
index 28a6019..d9164dd 100644
--- a/src/jake2/render/opengl/NEWTWin.java
+++ b/src/jake2/render/opengl/NEWTWin.java
@@ -9,12 +9,15 @@ import jake2.Defines;
import jake2.Globals;
import jake2.SizeChangeListener;
import jake2.client.VID;
+import jake2.game.cvar_t;
import jake2.qcommon.Cbuf;
+import jake2.qcommon.Cvar;
import jake2.render.Base;
import jake2.sys.NEWTKBD;
import java.util.List;
+import javax.media.nativewindow.CapabilitiesChooser;
import javax.media.nativewindow.util.Dimension;
import javax.media.nativewindow.util.DimensionImmutable;
import javax.media.nativewindow.util.SurfaceSize;
@@ -32,6 +35,7 @@ import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.util.MonitorMode;
import com.jogamp.newt.util.ScreenModeUtil;
+import com.jogamp.opengl.GenericGLCapabilitiesChooser;
public class NEWTWin {
ScreenMode oldDisplayMode = null;
@@ -117,12 +121,18 @@ public class NEWTWin {
if(null == window) {
final GLCapabilities caps = new GLCapabilities(glp);
- /*** FIXME ..
- caps.setRedBits(5);
- caps.setGreenBits(6);
- caps.setBlueBits(5);
- caps.setAlphaBits(0); */
+ CapabilitiesChooser chooser = null; // default
+ {
+ final cvar_t v = Cvar.Get("jogl_rgb565", "0", 0);
+ if( v.value != 0f ) {
+ caps.setRedBits(5);
+ caps.setGreenBits(6);
+ caps.setBlueBits(5);
+ chooser = new GenericGLCapabilitiesChooser(); // don't trust native GL-TK chooser
+ }
+ }
window = GLWindow.create(screen, caps);
+ window.setCapabilitiesChooser(chooser);
window.setTitle("Jake2 ("+driverName+"-newt-"+glp.getName().toLowerCase()+")");
}