diff options
3 files changed, 22 insertions, 5 deletions
diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/CanvasRenderer.java b/ardor3d-core/src/main/java/com/ardor3d/framework/CanvasRenderer.java index e6790df..8ec45a9 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/framework/CanvasRenderer.java +++ b/ardor3d-core/src/main/java/com/ardor3d/framework/CanvasRenderer.java @@ -60,6 +60,13 @@ public interface CanvasRenderer { void setScene(Scene scene); /** + * Creates a new renderer for this canvas renderer + * + * @return a new renderer + */ + Renderer createRenderer(); + + /** * Returns the renderer being used by this canvas renderer. * * @return the renderer used by this canvas renderer diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java index da235c7..ac5b136 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglCanvasRenderer.java @@ -124,6 +124,11 @@ public class JoglCanvasRenderer implements CanvasRenderer { return new JoglContextCapabilities(_context.getGL()); } + @Override + public JoglRenderer createRenderer() { + return new JoglRenderer(); + } + @MainThread public void init(final DisplaySettings settings, final boolean doSwap) { _doSwap = doSwap; @@ -148,7 +153,7 @@ public class JoglCanvasRenderer implements CanvasRenderer { ContextManager.addContext(_context, _currentContext); ContextManager.switchContext(_context); - _renderer = new JoglRenderer(); + _renderer = createRenderer(); if (settings.getSamples() != 0 && caps.isMultisampleSupported()) { final GL gl = GLContext.getCurrentGL(); diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglCanvasRenderer.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglCanvasRenderer.java index 51f579d..9bcc2ee 100644 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglCanvasRenderer.java +++ b/ardor3d-lwjgl/src/main/java/com/ardor3d/framework/lwjgl/LwjglCanvasRenderer.java @@ -22,11 +22,11 @@ import com.ardor3d.framework.Scene; import com.ardor3d.math.ColorRGBA; import com.ardor3d.math.Vector3; import com.ardor3d.renderer.Camera; +import com.ardor3d.renderer.Camera.ProjectionMode; import com.ardor3d.renderer.ContextCapabilities; import com.ardor3d.renderer.ContextManager; import com.ardor3d.renderer.RenderContext; import com.ardor3d.renderer.Renderer; -import com.ardor3d.renderer.Camera.ProjectionMode; import com.ardor3d.renderer.lwjgl.LwjglContextCapabilities; import com.ardor3d.renderer.lwjgl.LwjglRenderer; import com.ardor3d.util.Ardor3dException; @@ -67,6 +67,11 @@ public class LwjglCanvasRenderer implements CanvasRenderer { return new LwjglContextCapabilities(GLContext.getCapabilities()); } + @Override + public LwjglRenderer createRenderer() { + return new LwjglRenderer(); + } + @MainThread public void init(final DisplaySettings settings, final boolean doSwap) { _doSwap = doSwap; @@ -93,7 +98,7 @@ public class LwjglCanvasRenderer implements CanvasRenderer { ContextManager.addContext(this, _currentContext); ContextManager.switchContext(this); - _renderer = new LwjglRenderer(); + _renderer = createRenderer(); if (settings.getSamples() != 0 && caps.isMultisampleSupported()) { GL11.glEnable(ARBMultisample.GL_MULTISAMPLE_ARB); @@ -116,8 +121,8 @@ public class LwjglCanvasRenderer implements CanvasRenderer { } else { // use new width and height to set ratio. _camera.setFrustumPerspective(_camera.getFovY(), - (float) settings.getWidth() / (float) settings.getHeight(), _camera.getFrustumNear(), _camera - .getFrustumFar()); + (float) settings.getWidth() / (float) settings.getHeight(), _camera.getFrustumNear(), + _camera.getFrustumFar()); } } |