aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/render/Renderer.java
diff options
context:
space:
mode:
authorCarsten Weisse <[email protected]>2006-11-21 00:52:51 +0000
committerCarsten Weisse <[email protected]>2006-11-21 00:52:51 +0000
commit17b95195843d63063d989d6a99893ae6300f5ba5 (patch)
tree4ccd4fa9039724687039209c039344f285ef0b16 /src/jake2/render/Renderer.java
parent6cfce25cd7b75c03ee2fc6b238e68f7e4cabb058 (diff)
merge render-refactoring branch into the HEAD
Diffstat (limited to 'src/jake2/render/Renderer.java')
-rw-r--r--src/jake2/render/Renderer.java52
1 files changed, 32 insertions, 20 deletions
diff --git a/src/jake2/render/Renderer.java b/src/jake2/render/Renderer.java
index 6141d0c..3e48ac3 100644
--- a/src/jake2/render/Renderer.java
+++ b/src/jake2/render/Renderer.java
@@ -2,7 +2,7 @@
* Renderer.java
* Copyright (C) 2003
*
- * $Id: Renderer.java,v 1.6 2005-01-12 00:37:13 cawe Exp $
+ * $Id: Renderer.java,v 1.7 2006-11-21 00:51:22 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -25,39 +25,42 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package jake2.render;
-import java.util.Vector;
-
import jake2.client.refexport_t;
+import java.util.Vector;
+
/**
* Renderer
*
* @author cwei
*/
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 {
try {
- try {
- Class.forName("net.java.games.jogl.GL");
- Class.forName("jake2.render.JoglRenderer");
- } catch (ClassNotFoundException e) {
- // ignore the jogl drivers if runtime not in classpath
- }
- try {
+ try {
+ Class.forName("net.java.games.jogl.GL");
+ Class.forName("jake2.render.JoglRenderer");
+ } catch (ClassNotFoundException e) {
+ // ignore the fastjogl drivers if runtime not in classpath
+ }
+ try {
Class.forName("org.lwjgl.opengl.GL11");
- Class.forName("jake2.render.LWJGLRenderer");
+ Class.forName("jake2.render.LwjglRenderer");
} catch (ClassNotFoundException e) {
// ignore the lwjgl driver if runtime not in classpath
}
- try {
- Class.forName("net.java.games.jogl.GL");
- Class.forName("jake2.render.FastJoglRenderer");
- } catch (ClassNotFoundException e) {
- // ignore the fastjogl drivers if runtime not in classpath
- }
+ try {
+ Class.forName("javax.media.opengl.GL");
+ Class.forName("jake2.render.Jsr231Renderer");
+ } catch (ClassNotFoundException e) {
+ // ignore the jogl drivers if runtime not in classpath
+ }
} catch (Throwable e) {
e.printStackTrace();
}
@@ -72,18 +75,26 @@ public class Renderer {
}
}
- /**
+ /**
+ * Factory method to get the Renderer implementation.
+ * @return refexport_t (Renderer singleton)
+ */
+ public static refexport_t getDriver(String driverName) {
+ return getDriver(driverName, true);
+ }
+
+ /**
* Factory method to get the Renderer implementation.
* @return refexport_t (Renderer singleton)
*/
- public static refexport_t getDriver(String driverName) {
+ public static refexport_t getDriver(String driverName, boolean fast) {
// find a driver
Ref driver = null;
int count = drivers.size();
for (int i = 0; i < count; i++) {
driver = (Ref) drivers.get(i);
if (driver.getName().equals(driverName)) {
- return driver.GetRefAPI();
+ return driver.GetRefAPI((fast) ? fastRenderer : basicRenderer);
}
}
// null if driver not found
@@ -107,4 +118,5 @@ public class Renderer {
}
return names;
}
+
} \ No newline at end of file