aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/render
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-10-19 10:11:59 +0200
committerSven Gothel <[email protected]>2012-10-19 10:11:59 +0200
commit4c41dbb44670b0420e5f804911e1f729662598b7 (patch)
tree2a538c21dc468e93e4fddbcde48b59aedb4e9608 /src/jake2/render
parent5c21146b8fc75481b9ae164c2e9f5cfbfb8897a1 (diff)
Added JOGL2 Flags (README/Jake2.sh), New JOGL Renderer Order, ..
New JOGL Renderer Order, last comes first if not defined by 'vid_ref': - jogldummy - joglgl2 - jogles2 - jogles1 +++ README JOGL2 Flags: JOGL Renderer can be set via 'vid_ref', i.e. '+set vid_ref jogles2' - jogles1 ES1 renderer, may use GL2ES1 w/ 'jogl_gl2es1 1' - jogles2 ES1 renderer, may use GL2ES2 w/ 'jogl_gl2es2 1' - joglgl2 GL2 renderer, maybe disabled w/ 'jogl_gl2 0' - jogldummy NOP GL renderer to measure performance w/o GL costs Special GLProfile selection flags: - jogl_gl2 0 disable joglgl2, default enabled '1' - jogl_gl2es1 1 allow desktop GL2ES1 for jogles1 renderer, default disabled '0' - jogl_gl2es2 1 allow desktop GL2ES2 for jogles2 renderer, default disabled '0' Special drawable surface flags: - jogl_rgb565 1 requesting a RGB565 surface, otherwise request default RGB888 surface
Diffstat (limited to 'src/jake2/render')
-rw-r--r--src/jake2/render/JoglES1Renderer.java3
-rw-r--r--src/jake2/render/JoglES2Renderer.java2
-rw-r--r--src/jake2/render/JoglGL2Renderer.java3
-rw-r--r--src/jake2/render/Renderer.java20
-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
10 files changed, 64 insertions, 32 deletions
diff --git a/src/jake2/render/JoglES1Renderer.java b/src/jake2/render/JoglES1Renderer.java
index f63a836..7798019 100644
--- a/src/jake2/render/JoglES1Renderer.java
+++ b/src/jake2/render/JoglES1Renderer.java
@@ -29,7 +29,6 @@ import javax.media.nativewindow.util.Dimension;
import jake2.Defines;
import jake2.client.refdef_t;
import jake2.client.refexport_t;
-import jake2.qcommon.Cvar;
import jake2.render.opengl.JoglES1Driver;
import jake2.sys.NEWTKBD;
import jake2.sys.KBD;
@@ -69,8 +68,6 @@ final class JoglES1Renderer extends JoglES1Driver implements refexport_t, Ref {
// init the OpenGL drivers
impl.setGLDriver(this);
- // Cvar.Set("gl_clear", "1"); // FIXME
-
// pre init, reads Cvar's
if (!impl.R_Init(vid_xpos, vid_ypos)) {
return false;
diff --git a/src/jake2/render/JoglES2Renderer.java b/src/jake2/render/JoglES2Renderer.java
index dc836dc..dec8a4a 100644
--- a/src/jake2/render/JoglES2Renderer.java
+++ b/src/jake2/render/JoglES2Renderer.java
@@ -68,8 +68,6 @@ final class JoglES2Renderer extends JoglES2Driver implements refexport_t, Ref {
// init the OpenGL drivers
impl.setGLDriver(this);
- // Cvar.Set("gl_clear", "1"); // FIXME
-
// pre init, reads Cvar's
if (!impl.R_Init(vid_xpos, vid_ypos)) return false;
// activates the OpenGL context
diff --git a/src/jake2/render/JoglGL2Renderer.java b/src/jake2/render/JoglGL2Renderer.java
index 31eb25c..48432d7 100644
--- a/src/jake2/render/JoglGL2Renderer.java
+++ b/src/jake2/render/JoglGL2Renderer.java
@@ -29,7 +29,6 @@ import javax.media.nativewindow.util.Dimension;
import jake2.Defines;
import jake2.client.refdef_t;
import jake2.client.refexport_t;
-import jake2.qcommon.Cvar;
import jake2.render.opengl.JoglGL2Driver;
import jake2.sys.NEWTKBD;
import jake2.sys.KBD;
@@ -69,8 +68,6 @@ final class JoglGL2Renderer extends JoglGL2Driver implements refexport_t, Ref {
// init the OpenGL drivers
impl.setGLDriver(this);
- // Cvar.Set("gl_clear", "1"); // FIXME
-
// pre init, reads Cvar's
if (!impl.R_Init(vid_xpos, vid_ypos)) return false;
// activates the OpenGL context
diff --git a/src/jake2/render/Renderer.java b/src/jake2/render/Renderer.java
index 7b83525..1f29245 100644
--- a/src/jake2/render/Renderer.java
+++ b/src/jake2/render/Renderer.java
@@ -39,7 +39,7 @@ public class Renderer {
static RenderAPI fastRenderer = new jake2.render.fast.Misc();
static RenderAPI basicRenderer = new jake2.render.basic.Misc();
- static Vector drivers = new Vector(3);
+ static Vector<Ref> drivers = new Vector<Ref>(4);
static {
try {
@@ -59,16 +59,16 @@ public class Renderer {
// t.printStackTrace();
}
try {
- Class.forName("javax.media.opengl.GL2ES1");
- Class.forName("jake2.render.JoglES1Renderer");
+ Class.forName("javax.media.opengl.GL2ES2");
+ Class.forName("jake2.render.JoglES2Renderer");
} catch (Throwable t) {
// ignore the new jogl driver if runtime not in classpath
System.err.println("Catched exception: "+t.getMessage());
// t.printStackTrace();
}
try {
- Class.forName("javax.media.opengl.GL2ES2");
- Class.forName("jake2.render.JoglES2Renderer");
+ Class.forName("javax.media.opengl.GL2ES1");
+ Class.forName("jake2.render.JoglES1Renderer");
} catch (Throwable t) {
// ignore the new jogl driver if runtime not in classpath
System.err.println("Catched exception: "+t.getMessage());
@@ -109,7 +109,7 @@ public class Renderer {
Ref driver = null;
int count = drivers.size();
for (int i = 0; i < count; i++) {
- driver = (Ref) drivers.get(i);
+ driver = drivers.get(i);
if (driver.getName().equals(driverName)) {
return driver.GetRefAPI((fast) ? fastRenderer : basicRenderer);
}
@@ -119,13 +119,11 @@ public class Renderer {
}
public static String getDefaultName() {
- return (drivers.isEmpty()) ? null : ((Ref) drivers.firstElement())
- .getName();
+ return (drivers.isEmpty()) ? null : drivers.firstElement().getName();
}
public static String getPreferedName() {
- return (drivers.isEmpty()) ? null : ((Ref) drivers.lastElement())
- .getName();
+ return (drivers.isEmpty()) ? null : drivers.lastElement().getName();
}
public static String[] getDriverNames() {
@@ -136,7 +134,7 @@ public class Renderer {
int count = drivers.size();
String[] names = new String[count];
for (int i = 0; i < count; i++) {
- names[i] = ((Ref) drivers.get(i)).getName();
+ names[i] = drivers.get(i).getName();
}
return names;
}
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()+")");
}