Commits

Michael Ludwig committed 10bd4d2

Complete JOGL repair after the threading model simplification.

Comments (0)

Files changed (17)

ferox-renderer/ferox-renderer-api/src/main/java/com/ferox/renderer/GlslRenderer.java

     
     public void setUniform(String name, @Const Matrix4 val);
     
+    // FIXME should I get rid of the array versions?
     public void setUniform(String name, float[] vals);
     
     

ferox-renderer/ferox-renderer-jogl/src/main/java/com/ferox/renderer/impl/jogl/JoglAWTSurface.java

 import com.ferox.renderer.DisplayMode;
 import com.ferox.renderer.DisplayMode.PixelFormat;
 import com.ferox.renderer.OnscreenSurfaceOptions;
-import com.ferox.renderer.OnscreenSurfaceOptions.AntiAliasMode;
+import com.ferox.renderer.OnscreenSurfaceOptions.MultiSampling;
 import com.ferox.renderer.OnscreenSurfaceOptions.DepthFormat;
 import com.ferox.renderer.OnscreenSurfaceOptions.StencilFormat;
 import com.ferox.renderer.impl.AbstractFramework;
             break;
         }
 
-        AntiAliasMode aa = AntiAliasMode.NONE;
+        MultiSampling aa = MultiSampling.NONE;
         if (sampleBuffers != 0) {
             switch (samples) {
             case 8:
-                aa = AntiAliasMode.EIGHT_X;
+                aa = MultiSampling.EIGHT_X;
                 break;
             case 4:
-                aa = AntiAliasMode.FOUR_X;
+                aa = MultiSampling.FOUR_X;
                 break;
             case 2:
-                aa = AntiAliasMode.TWO_X;
+                aa = MultiSampling.TWO_X;
                 break;
             default:
-                aa = AntiAliasMode.UNKNOWN;
+                aa = MultiSampling.UNKNOWN;
             }
 
             gl.glEnable(GL.GL_MULTISAMPLE);
             options = options.setFullscreenMode(new DisplayMode(fullscreen.getWidth(), fullscreen.getHeight(), format));
         }
         
-        options = options.setAntiAliasMode(aa)
+        options = options.setMultiSampling(aa)
                          .setDepthFormat(df)
                          .setStencilFormat(sf);
     }
             break;
         }
 
-        switch (request.getAntiAliasMode()) {
+        switch (request.getMultiSampling()) {
         case EIGHT_X:
             caps.setNumSamples(8);
             caps.setSampleBuffers(true);

ferox-renderer/ferox-renderer-jogl/src/main/java/com/ferox/renderer/impl/jogl/JoglContext.java

 import javax.media.opengl.GLContext;
 
 import com.ferox.renderer.RenderCapabilities;
-import com.ferox.renderer.RenderException;
+import com.ferox.renderer.FrameworkException;
 import com.ferox.renderer.impl.OpenGLContext;
 import com.ferox.renderer.impl.RendererProvider;
 import com.ferox.resource.Resource;
     public void makeCurrent() {
         int result = context.makeCurrent();
         if (result == GLContext.CONTEXT_NOT_CURRENT)
-            throw new RenderException("Unable to make context current");
+            throw new FrameworkException("Unable to make context current");
         
         for (Runnable task: cleanupTasks)
             task.run();

ferox-renderer/ferox-renderer-jogl/src/main/java/com/ferox/renderer/impl/jogl/JoglFboTextureSurface.java

 import javax.media.opengl.GL;
 import javax.media.opengl.GL2GL3;
 
-import com.ferox.renderer.RenderException;
+import com.ferox.renderer.FrameworkException;
 import com.ferox.renderer.TextureSurfaceOptions;
 import com.ferox.renderer.impl.AbstractFramework;
 import com.ferox.renderer.impl.AbstractTextureSurface;
 
         public FrameBufferObject(JoglContext context) {
             if (context == null)
-                throw new RenderException("FramebufferObject's can only be constructed when there's a current context");
+                throw new FrameworkException("FramebufferObject's can only be constructed when there's a current context");
             if (!context.getRenderCapabilities().getFboSupport())
-                throw new RenderException("Current hardware doesn't support the creation of fbos");
+                throw new FrameworkException("Current hardware doesn't support the creation of fbos");
 
             GL2GL3 gl = getGL(context);
             
                 if (gl.glGetError() == GL.GL_OUT_OF_MEMORY) {
                     gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, 0);
                     destroy();
-                    throw new RenderException("Error creating a new FBO, not enough memory for the depth RenderBuffer");
+                    throw new FrameworkException("Error creating a new FBO, not enough memory for the depth RenderBuffer");
                 } else
                     gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, 0);
                 gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, 
                 }
                 // clean-up and then throw an exception
                 destroy();
-                throw new RenderException(msg);
+                throw new FrameworkException(msg);
             }
 
             // restore the old binding

ferox-renderer/ferox-renderer-jogl/src/main/java/com/ferox/renderer/impl/jogl/JoglFixedFunctionRenderer.java

 package com.ferox.renderer.impl.jogl;
 
+import java.nio.FloatBuffer;
 import java.util.EnumSet;
 
 import javax.media.opengl.GL;
 import com.ferox.renderer.RenderCapabilities;
 import com.ferox.renderer.impl.AbstractFixedFunctionRenderer;
 import com.ferox.renderer.impl.AbstractSurface;
+import com.ferox.renderer.impl.BufferUtil;
 import com.ferox.renderer.impl.OpenGLContext;
-import com.ferox.renderer.impl.ResourceHandle;
 import com.ferox.renderer.impl.ResourceManager;
 import com.ferox.renderer.impl.drivers.TextureHandle;
 import com.ferox.renderer.impl.drivers.VertexBufferObjectHandle;
     private boolean initialized;
     
     // math object transfer objects
-    private final float[] matrixBuffer;
-    private final float[] vector4Buffer;
-    private final float[] vector3Buffer;
+    private final FloatBuffer transferBuffer;
     
     // state tracking
     private boolean alphaTestEnabled;
         
         initialized = false;
         
-        matrixBuffer = new float[16];
-        vector4Buffer = new float[4];
-        vector3Buffer = new float[3];
+        transferBuffer = BufferUtil.newFloatBuffer(16);
         alphaTestEnabled = false;
     }
     
 
     @Override
     protected void glSetMatrix(@Const Matrix4 matrix) {
-        matrix.get(matrixBuffer, 0, false);
-        getGL().glLoadMatrixf(matrixBuffer, 0);
+        matrix.get(transferBuffer, 0, false);
+        transferBuffer.rewind();
+        getGL().glLoadMatrixf(transferBuffer);
     }
 
     @Override
-    protected void glAlphaTest(Comparison test, float ref) {
+    protected void glAlphaTest(Comparison test, double ref) {
         if (test == Comparison.ALWAYS) {
             if (alphaTestEnabled) {
                 alphaTestEnabled = false;
                 glEnable(GL2.GL_ALPHA_TEST, true);
             }
             
-            getGL().glAlphaFunc(Utils.getGLPixelTest(test), ref);
+            getGL().glAlphaFunc(Utils.getGLPixelTest(test), (float) ref);
         }
     }
 
     @Override
     protected void glFogColor(@Const Vector4 color) {
-        color.get(vector4Buffer, 0);
-        getGL().glFogfv(GL2.GL_FOG_COLOR, vector4Buffer, 0);
+        color.get(transferBuffer, 0);
+        transferBuffer.rewind();
+        getGL().glFogfv(GL2.GL_FOG_COLOR, transferBuffer);
     }
 
     @Override
     }
 
     @Override
-    protected void glFogDensity(float density) {
-        getGL().glFogf(GL2.GL_FOG_DENSITY, density);
+    protected void glFogDensity(double density) {
+        getGL().glFogf(GL2.GL_FOG_DENSITY, (float) density);
     }
 
     @Override
-    protected void glFogRange(float start, float end) {
-        getGL().glFogf(GL2.GL_FOG_START, start);
-        getGL().glFogf(GL2.GL_FOG_END, end);
+    protected void glFogRange(double start, double end) {
+        getGL().glFogf(GL2.GL_FOG_START, (float) start);
+        getGL().glFogf(GL2.GL_FOG_END, (float) end);
     }
 
     @Override
 
     @Override
     protected void glGlobalLighting(@Const Vector4 ambient) {
-        ambient.get(vector4Buffer, 0);
-        getGL().glLightModelfv(GL2.GL_LIGHT_MODEL_AMBIENT, vector4Buffer, 0);
+        ambient.get(transferBuffer, 0);
+        transferBuffer.rewind();
+        getGL().glLightModelfv(GL2.GL_LIGHT_MODEL_AMBIENT, transferBuffer);
     }
     
     
 
     @Override
     protected void glLightColor(int light, LightColor lc, @Const Vector4 color) {
-        color.get(vector4Buffer, 0);
+        color.get(transferBuffer, 0);
+        transferBuffer.rewind();
+
         int c = getGLLight(lc);
-        getGL().glLightfv(GL2.GL_LIGHT0 + light, c, vector4Buffer, 0);
+        getGL().glLightfv(GL2.GL_LIGHT0 + light, c, transferBuffer);
     }
 
     @Override
 
     @Override
     protected void glLightPosition(int light, @Const Vector4 pos) {
-        pos.get(vector4Buffer, 0);
-        getGL().glLightfv(GL2.GL_LIGHT0 + light, GL2.GL_POSITION, vector4Buffer, 0);
+        pos.get(transferBuffer, 0);
+        getGL().glLightfv(GL2.GL_LIGHT0 + light, GL2.GL_POSITION, transferBuffer);
     }
 
     @Override
     protected void glLightDirection(int light, @Const Vector3 dir) {
-        dir.get(vector3Buffer, 0);
-        getGL().glLightfv(GL2.GL_LIGHT0 + light, GL2.GL_SPOT_DIRECTION, vector3Buffer, 0);
+        dir.get(transferBuffer, 0);
+        transferBuffer.rewind();
+
+        getGL().glLightfv(GL2.GL_LIGHT0 + light, GL2.GL_SPOT_DIRECTION, transferBuffer);
     }
 
     @Override
-    protected void glLightAngle(int light, float angle) {
-        getGL().glLightf(GL2.GL_LIGHT0 + light, GL2.GL_SPOT_CUTOFF, angle);
+    protected void glLightAngle(int light, double angle) {
+        getGL().glLightf(GL2.GL_LIGHT0 + light, GL2.GL_SPOT_CUTOFF, (float) angle);
     }
 
     @Override
-    protected void glLightAttenuation(int light, float constant, float linear, float quadratic) {
+    protected void glLightAttenuation(int light, double constant, double linear, double quadratic) {
         light += GL2.GL_LIGHT0;
         GL2 gl = getGL();
-        gl.glLightf(light, GL2.GL_CONSTANT_ATTENUATION, constant);
-        gl.glLightf(light, GL2.GL_LINEAR_ATTENUATION, linear);
-        gl.glLightf(light, GL2.GL_QUADRATIC_ATTENUATION, quadratic);
+        gl.glLightf(light, GL2.GL_CONSTANT_ATTENUATION, (float) constant);
+        gl.glLightf(light, GL2.GL_LINEAR_ATTENUATION, (float) linear);
+        gl.glLightf(light, GL2.GL_QUADRATIC_ATTENUATION, (float) quadratic);
     }
 
     @Override
     }
 
     @Override
-    protected void glLineWidth(float width) {
-        getGL().glLineWidth(width);
+    protected void glLineWidth(double width) {
+        getGL().glLineWidth((float) width);
     }
 
     @Override
     protected void glMaterialColor(LightColor component, @Const Vector4 color) {
-        color.get(vector4Buffer, 0);
+        color.get(transferBuffer, 0);
+        transferBuffer.rewind();
+
         int c = getGLLight(component);
         if (component == LightColor.DIFFUSE)
-            getGL().glColor4fv(vector4Buffer, 0);
+            getGL().glColor4fv(transferBuffer);
         else
-            getGL().glMaterialfv(GL.GL_FRONT_AND_BACK, c, vector4Buffer, 0);
+            getGL().glMaterialfv(GL.GL_FRONT_AND_BACK, c, transferBuffer);
     }
 
     @Override
-    protected void glMaterialShininess(float shininess) {
-        getGL().glMaterialf(GL2.GL_FRONT_AND_BACK, GL2.GL_SHININESS, shininess);
+    protected void glMaterialShininess(double shininess) {
+        getGL().glMaterialf(GL2.GL_FRONT_AND_BACK, GL2.GL_SHININESS, (float) shininess);
     }
 
     @Override
     }
 
     @Override
-    protected void glPointWidth(float width) {
-        getGL().glPointSize(width);
+    protected void glPointWidth(double width) {
+        getGL().glPointSize((float) width);
     }
 
     @Override
     }
 
     @Override
-    protected void glBindTexture(Target target, ResourceHandle image) {
+    protected void glBindTexture(Target target, TextureHandle image) {
         if (supportedTargets.contains(target)) {
             int glTarget = Utils.getGLTextureTarget(target);
-            TextureHandle th = (TextureHandle) image;
             
             GL2 gl = getGL();
-            if (th == null)
+            if (image == null)
                 ((JoglContext) context).bindTexture(gl, glTarget, 0);
             else
-                ((JoglContext) context).bindTexture(gl, glTarget, th.texID);
+                ((JoglContext) context).bindTexture(gl, glTarget, image.texID);
         }
     }
 
 
     @Override
     protected void glTextureColor(@Const Vector4 color) {
-        color.get(vector4Buffer, 0);
-        getGL().glTexEnvfv(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_COLOR, vector4Buffer, 0);
+        color.get(transferBuffer, 0);
+        transferBuffer.rewind();
+
+        getGL().glTexEnvfv(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_COLOR, transferBuffer);
     }
 
     @Override
     }
 
     @Override
-    protected void glCombineOp(int operand, CombineOp op, boolean rgb) {
+    protected void glCombineOp(int operand, CombineOperand op, boolean rgb) {
         if (!supportsCombine)
             return;
         
 
     @Override
     protected void glTexEyePlane(TexCoord coord, @Const Vector4 plane) {
-        plane.get(vector4Buffer, 0);
+        plane.get(transferBuffer, 0);
+        transferBuffer.rewind();
+
         int tc = Utils.getGLTexCoord(coord, false);
-        getGL().glTexGenfv(tc, GL2.GL_EYE_PLANE, vector4Buffer, 0);
-    }
-
-    @Override
-    protected void glTexEnvMode(EnvMode mode) {
-        if (mode == EnvMode.COMBINE && !supportsCombine)
-            mode = EnvMode.MODULATE;
-        
-        int envMode = Utils.getGLTexEnvMode(mode);
-        getGL().glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, envMode);
+        getGL().glTexGenfv(tc, GL2.GL_EYE_PLANE, transferBuffer);
     }
 
     @Override
     protected void glTexObjPlane(TexCoord coord, @Const Vector4 plane) {
-        plane.get(vector4Buffer, 0);
+        plane.get(transferBuffer, 0);
+        transferBuffer.rewind();
+
         int tc = Utils.getGLTexCoord(coord, false);
-        getGL().glTexGenfv(tc, GL2.GL_OBJECT_PLANE, vector4Buffer, 0);
+        getGL().glTexGenfv(tc, GL2.GL_OBJECT_PLANE, transferBuffer);
     }
 
     @Override
     }
 
     @Override
-    protected void glBindArrayVbo(ResourceHandle handle) {
+    protected void glBindArrayVbo(VertexBufferObjectHandle h) {
         JoglContext ctx = (JoglContext) context;
         GL2 gl = getGL();
-        VertexBufferObjectHandle h = (VertexBufferObjectHandle) handle;
         
         if (h != null) {
             if (h.mode != StorageMode.IN_MEMORY) {
     }
 
     @Override
-    protected void glAttributePointer(VertexTarget target, ResourceHandle handle, int offset,
+    protected void glAttributePointer(VertexTarget target, VertexBufferObjectHandle h, int offset,
                                       int stride, int elementSize) {
-        VertexBufferObjectHandle h = (VertexBufferObjectHandle) handle;
         int strideBytes = (stride + elementSize) * h.dataType.getByteCount();
         
         if (h.mode == StorageMode.IN_MEMORY) {

ferox-renderer/ferox-renderer-jogl/src/main/java/com/ferox/renderer/impl/jogl/JoglFramework.java

 import com.ferox.renderer.impl.ResourceDriver;
 
 public class JoglFramework extends AbstractFramework {
-    private JoglFramework(JoglSurfaceFactory factory, int numThreads, ResourceDriver<?>... drivers) {
-        super(factory, numThreads, drivers);
+    private JoglFramework(JoglSurfaceFactory factory, ResourceDriver... drivers) {
+        super(factory, drivers);
     }
     
     public static JoglFramework create() {
-        return create(2);
+        return create(false, false);
     }
     
-    public static JoglFramework create(int numThreads) {
-        return create(numThreads, false, false);
-    }
-    
-    public static JoglFramework create(int numThreads,
-                                       boolean forceNoFfp, boolean forceNoGlsl) {
-        return create(numThreads, forceNoFfp, forceNoGlsl, false, false);
+    public static JoglFramework create(boolean forceNoFfp, boolean forceNoGlsl) {
+        return create(forceNoFfp, forceNoGlsl, false, false);
     }
 
-    public static JoglFramework create(int numThreads,
-                                       boolean forceNoFfp, boolean forceNoGlsl,
+    public static JoglFramework create(boolean forceNoFfp, boolean forceNoGlsl,
                                        boolean forceNoPbuffers, boolean forceNoFbos) {
 
         int capBits = 0;
             Threading.disableSingleThreading();
         
         JoglSurfaceFactory factory = new JoglSurfaceFactory(profile, capBits);
-        JoglFramework framework = new JoglFramework(factory, numThreads, 
+        JoglFramework framework = new JoglFramework(factory,
                                                     new JoglTextureResourceDriver(),
                                                     new JoglVertexBufferObjectResourceDriver(),
                                                     new JoglGlslShaderResourceDriver());

ferox-renderer/ferox-renderer-jogl/src/main/java/com/ferox/renderer/impl/jogl/JoglGlslRenderer.java

 import com.ferox.renderer.impl.AbstractGlslRenderer;
 import com.ferox.renderer.impl.AbstractSurface;
 import com.ferox.renderer.impl.OpenGLContext;
-import com.ferox.renderer.impl.ResourceHandle;
 import com.ferox.renderer.impl.ResourceManager;
 import com.ferox.renderer.impl.drivers.GlslShaderHandle;
 import com.ferox.renderer.impl.drivers.GlslShaderHandle.Uniform;
     }
 
     @Override
-    protected void glBindTexture(int tex, Target target, ResourceHandle handle) {
+    protected void glBindTexture(int tex, Target target, TextureHandle handle) {
         if (supportedTargets.contains(target)) {
             JoglContext ctx = (JoglContext) context;
             GL2GL3 gl = getGL();
             ctx.setActiveTexture(gl, tex);
             ctx.bindTexture(gl, Utils.getGLTextureTarget(target), 
-                            (handle == null ? 0 : ((TextureHandle) handle).texID));
+                            (handle == null ? 0 : handle.texID));
         }
     }
 
     }
 
     @Override
-    protected void glBindArrayVbo(ResourceHandle handle) {
+    protected void glBindArrayVbo(VertexBufferObjectHandle h) {
         JoglContext ctx = (JoglContext) context;
         GL2GL3 gl = getGL();
-        VertexBufferObjectHandle h = (VertexBufferObjectHandle) handle;
         
         if (h != null) {
             if (h.mode != StorageMode.IN_MEMORY) {
     }
 
     @Override
-    protected void glAttributePointer(int attr, ResourceHandle handle, int offset, int stride,
-                                      int elementSize) {
-        VertexBufferObjectHandle h = (VertexBufferObjectHandle) handle;
+    protected void glAttributePointer(int attr, VertexBufferObjectHandle h, 
+                                      int offset, int stride, int elementSize) {
         int strideBytes = (elementSize + stride) * h.dataType.getByteCount();
         
         if (h.mode == StorageMode.IN_MEMORY) {

ferox-renderer/ferox-renderer-jogl/src/main/java/com/ferox/renderer/impl/jogl/JoglPbufferTextureSurface.java

             caps.setAlphaBits(0);
         } else {
             TextureFormat format = colors[0].getFormat();
-            if (format == TextureFormat.ALPHA_FLOAT || format == TextureFormat.LUMINANCE_ALPHA_FLOAT ||
-                format == TextureFormat.LUMINANCE_FLOAT || format == TextureFormat.RGB_FLOAT ||
+            if (format == TextureFormat.R_FLOAT || format == TextureFormat.RG_FLOAT ||
+                format == TextureFormat.DEPTH_FLOAT || format == TextureFormat.RGB_FLOAT ||
                 format == TextureFormat.RGBA_FLOAT)
                 caps.setPbufferFloatingPointBuffers(true);
             
             switch(format) {
             // 8, 8, 8, 0
-            case LUMINANCE: case RGB: case BGR:
+            case R: case RGB: case BGR:
                 caps.setRedBits(8); caps.setGreenBits(8); caps.setBlueBits(8); caps.setAlphaBits(0);
                 break;
             // 5, 6, 5, 0
                 caps.setRedBits(5); caps.setGreenBits(6); caps.setBlueBits(5); caps.setAlphaBits(8);
                 break;
             // 32, 32, 32, 32
-            case ALPHA_FLOAT: case LUMINANCE_ALPHA_FLOAT: 
-            case LUMINANCE_FLOAT: case RGBA_FLOAT:
+            case R_FLOAT: case RG_FLOAT: case RGBA_FLOAT:
                 caps.setRedBits(32); caps.setGreenBits(32); caps.setBlueBits(32); caps.setAlphaBits(32);
                 break;
             // 32, 32, 32, 0
                 caps.setRedBits(32); caps.setGreenBits(32); caps.setBlueBits(32); caps.setAlphaBits(0);
                 break;
             // 8, 8, 8, 8
-            case LUMINANCE_ALPHA: case ALPHA: case BGRA: case BGRA_8888: 
+            case RG: case BGRA: case BGRA_8888: 
             case RGBA_8888: case RGBA: case ARGB_8888: case ABGR_8888:
             default:
                 caps.setRedBits(8); caps.setGreenBits(8); caps.setBlueBits(8); caps.setAlphaBits(8);

ferox-renderer/ferox-renderer-jogl/src/main/java/com/ferox/renderer/impl/jogl/JoglRendererDelegate.java

 import com.ferox.renderer.Renderer.Comparison;
 import com.ferox.renderer.Renderer.DrawStyle;
 import com.ferox.renderer.Renderer.PolygonType;
-import com.ferox.renderer.Renderer.StencilOp;
+import com.ferox.renderer.Renderer.StencilUpdate;
 import com.ferox.renderer.impl.AbstractSurface;
 import com.ferox.renderer.impl.OpenGLContext;
 import com.ferox.renderer.impl.RendererDelegate;
-import com.ferox.renderer.impl.ResourceHandle;
 import com.ferox.renderer.impl.ResourceManager;
 import com.ferox.renderer.impl.drivers.VertexBufferObjectHandle;
 import com.ferox.resource.VertexBufferObject.StorageMode;
     private boolean initialized;
     
     // state tracking for buffer clearing
-    private final Vector4 clearColor = new Vector4(0f, 0f, 0f, 0f);
-    private float clearDepth = 1f;
+    private final Vector4 clearColor = new Vector4(0, 0, 0, 0);
+    private double clearDepth = 1f;
     private int clearStencil = 0;
     
     // state tracking for draw styles
     }
 
     @Override
-    protected void glDepthOffset(float factor, float units) {
-        getGL().glPolygonOffset(factor, units);
+    protected void glDepthOffset(double factor, double units) {
+        getGL().glPolygonOffset((float) factor, (float) units);
     }
 
     @Override
     }
 
     @Override
-    protected void glStencilUpdate(StencilOp stencilFail, StencilOp depthFail, StencilOp depthPass, boolean isFront) {
+    protected void glStencilUpdate(StencilUpdate stencilFail, StencilUpdate depthFail, StencilUpdate depthPass, boolean isFront) {
         int sf = Utils.getGLStencilOp(stencilFail, supportsStencilWrap);
         int df = Utils.getGLStencilOp(depthFail, supportsStencilWrap);
         int dp = Utils.getGLStencilOp(depthPass, supportsStencilWrap);
 
     @Override
     public void clear(boolean clearColor, boolean clearDepth, boolean clearStencil,
-                      @Const Vector4 color, float depth, int stencil) {
+                      @Const Vector4 color, double depth, int stencil) {
         if (color == null)
             throw new NullPointerException("Clear color cannot be null");
         if (depth < 0f || depth > 1f)
         }
         if (this.clearDepth != depth) {
             this.clearDepth = depth;
-            gl.glClearDepthf(depth);
+            gl.glClearDepthf((float) depth);
         }
         if (this.clearStencil != stencil) {
             this.clearStencil = stencil;
     }
 
     @Override
-    protected void glDrawElements(PolygonType type, ResourceHandle handle, int offset, int count) {
-        VertexBufferObjectHandle h = (VertexBufferObjectHandle) handle;
+    protected void glDrawElements(PolygonType type, VertexBufferObjectHandle h, int offset, int count) {
         int glPolyType = Utils.getGLPolygonConnectivity(type);
         int glDataType = Utils.getGLType(h.dataType);
         
     }
 
     @Override
-    protected void glBindElementVbo(ResourceHandle handle) {
+    protected void glBindElementVbo(VertexBufferObjectHandle h) {
         GL2GL3 gl = getGL();
         JoglContext ctx = (JoglContext) context;
         
-        VertexBufferObjectHandle h = (VertexBufferObjectHandle) handle;
-        
         if (h != null) {
             if (h.mode != StorageMode.IN_MEMORY) {
                 // Must bind the VBO

ferox-renderer/ferox-renderer-jogl/src/main/java/com/ferox/renderer/impl/jogl/JoglSurfaceFactory.java

     }
 
     @Override
-    public OpenGLContext createShadowContext(OpenGLContext sharedContext) {
+    public OpenGLContext createOffscreenContext(OpenGLContext sharedContext) {
         if ((capBits & JoglRenderCapabilities.FORCE_NO_PBUFFER) == 0 
             && GLDrawableFactory.getFactory(profile).canCreateGLPbuffer(null))
             return PbufferShadowContext.create(this, (JoglContext) sharedContext, new JoglRendererProvider());

ferox-renderer/ferox-renderer-jogl/src/main/java/com/ferox/renderer/impl/jogl/OnscreenShadowContext.java

 
     /**
      * Create a new OnscreenShadowContext that will be returned by
-     * {@link JoglSurfaceFactory#createShadowContext(com.ferox.renderer.impl.OpenGLContext)}
+     * {@link JoglSurfaceFactory#createOffscreenContext(com.ferox.renderer.impl.OpenGLContext)}
      * 
      * @param creator The JoglSurfaceFactory that is creating the shadow context
      * @param shareWith The JoglContext to share object data with

ferox-renderer/ferox-renderer-jogl/src/main/java/com/ferox/renderer/impl/jogl/PbufferShadowContext.java

     
     /**
      * Create a new PbufferShadowContext that will be returned by
-     * {@link JoglSurfaceFactory#createShadowContext(com.ferox.renderer.impl.OpenGLContext)}
+     * {@link JoglSurfaceFactory#createOffscreenContext(com.ferox.renderer.impl.OpenGLContext)}
      * .
      * 
      * @param creator The JoglSurfaceFactory that is creating the shadow context

ferox-renderer/ferox-renderer-jogl/src/main/java/com/ferox/renderer/impl/jogl/Utils.java

 import javax.media.opengl.GL3;
 
 import com.ferox.renderer.FixedFunctionRenderer.CombineFunction;
-import com.ferox.renderer.FixedFunctionRenderer.CombineOp;
+import com.ferox.renderer.FixedFunctionRenderer.CombineOperand;
 import com.ferox.renderer.FixedFunctionRenderer.CombineSource;
-import com.ferox.renderer.FixedFunctionRenderer.EnvMode;
 import com.ferox.renderer.FixedFunctionRenderer.TexCoord;
 import com.ferox.renderer.FixedFunctionRenderer.TexCoordSource;
 import com.ferox.renderer.Renderer.BlendFactor;
 import com.ferox.renderer.Renderer.Comparison;
 import com.ferox.renderer.Renderer.DrawStyle;
 import com.ferox.renderer.Renderer.PolygonType;
-import com.ferox.renderer.Renderer.StencilOp;
+import com.ferox.renderer.Renderer.StencilUpdate;
 import com.ferox.resource.BufferData.DataType;
 import com.ferox.resource.GlslShader.AttributeType;
 import com.ferox.resource.GlslShader.ShaderType;
         case DEPTH:
             return GL2.GL_DEPTH_COMPONENT;
 
-            // alpha formats
-        case ALPHA:
-        case ALPHA_FLOAT:
+            // red formats
+        case R:
+        case R_FLOAT:
             return GL2.GL_ALPHA;
 
-            // luminance formats
-        case LUMINANCE:
-        case LUMINANCE_FLOAT:
-            return GL2.GL_LUMINANCE;
-
-            // LA formats
-        case LUMINANCE_ALPHA:
-        case LUMINANCE_ALPHA_FLOAT:
+            // RG formats
+        case RG:
+        case RG_FLOAT:
             return GL2.GL_LUMINANCE_ALPHA;
 
         }
             return GL2.GL_RGB32F;
         case RGBA_FLOAT:
             return GL2.GL_RGBA32F;
-        case ALPHA_FLOAT:
+        case R_FLOAT:
             return GL2.GL_ALPHA32F;
-        case LUMINANCE_FLOAT:
-            return GL2.GL_LUMINANCE32F;
-        case LUMINANCE_ALPHA_FLOAT:
+        case RG_FLOAT:
             return GL2.GL_LUMINANCE_ALPHA32F;
 
             // DXT_n compression
 
             // if we've gotten here, we have a type-less format, and have to
             // take the type into account
-        case ALPHA:
+        case R:
             if (type == DataType.UNSIGNED_BYTE)
                 return GL2.GL_ALPHA8;
             else if (type == DataType.UNSIGNED_SHORT || type == DataType.UNSIGNED_INT)
                 return GL2.GL_ALPHA16;
             else
                 return GL2.GL_ALPHA;
-        case LUMINANCE:
-            if (type == DataType.UNSIGNED_BYTE)
-                return GL2.GL_LUMINANCE8;
-            else if (type == DataType.UNSIGNED_SHORT || type == DataType.UNSIGNED_INT)
-                return GL2.GL_LUMINANCE16;
-            else
-                return GL2.GL_LUMINANCE;
-        case LUMINANCE_ALPHA:
+        case RG:
             if (type == DataType.UNSIGNED_BYTE)
                 return GL2.GL_LUMINANCE8_ALPHA8;
             else if (type == DataType.UNSIGNED_SHORT || type == DataType.UNSIGNED_INT)
     }
 
     /** Op must not be null. */
-    public static int getGLStencilOp(StencilOp op, boolean wrapSupported) {
+    public static int getGLStencilOp(StencilUpdate op, boolean wrapSupported) {
         switch (op) {
         case DECREMENT:
             return GL2.GL_DECR;
         return -1;
     }
 
-    /** Mode must not be null. */
-    public static int getGLTexEnvMode(EnvMode mode) {
-        switch (mode) {
-        case REPLACE:
-            return GL2.GL_REPLACE;
-        case DECAL:
-            return GL2.GL_DECAL;
-        case MODULATE:
-            return GL2.GL_MODULATE;
-        case BLEND:
-            return GL2.GL_BLEND;
-        case COMBINE:
-            return GL2.GL_COMBINE;
-        }
-
-        return -1;
-    }
-
     /**
      * Should not be called with ATTRIBUTE or null, as nothing parallels its meaning.
      */
     }
 
     /** Op must not be null. */
-    public static int getGLCombineOp(CombineOp op) {
+    public static int getGLCombineOp(CombineOperand op) {
         switch (op) {
         case ALPHA:
             return GL2.GL_SRC_ALPHA;

ferox-renderer/ferox-renderer-jogl/src/test/java/com/ferox/renderer/impl/jogl/FixedFunctionRenderTest.java

 public class FixedFunctionRenderTest {
     
     public static void main(String[] args) throws Exception {
-        Framework framework = JoglFramework.create(1, false, false, true, false);
+        Framework framework = JoglFramework.create(false, false, true, false);
         System.out.println(framework.getCapabilities().getGlslVersion() + " " + framework.getCapabilities().getMaxTexture3DSize());
         OnscreenSurface window = framework.createSurface(new OnscreenSurfaceOptions().setWidth(800)
                                                                                      .setHeight(600)
             while(true) {
                 if (window.isDestroyed())
                     break;
-                framework.queue(pass, "render").get();
-                framework.flush(window, "render");
-                framework.sync("render");
+                framework.queue(pass).get();
+                framework.flush(window);
+                framework.sync();
                 
                 frames++;
                 if (System.currentTimeMillis() - now > 1000) {

ferox-renderer/ferox-renderer-jogl/src/test/java/com/ferox/renderer/impl/jogl/GlslRenderTest.java

         "}";
     
     public static void main(String[] args) throws Exception {
-        Framework framework = JoglFramework.create(1, false, false, true, false);
+        Framework framework = JoglFramework.create(false, false, true, false);
         System.out.println(framework.getCapabilities().getGlslVersion() + " " + framework.getCapabilities().getMaxTexture3DSize());
         OnscreenSurface window = framework.createSurface(new OnscreenSurfaceOptions().setWidth(800)
                                                                                      .setHeight(600)
             while(true) {
                 if (window.isDestroyed())
                     break;
-                framework.queue(pass, "render").get();
-                framework.flush(window, "render");
-                framework.sync("render");
+                framework.queue(pass).get();
+                framework.flush(window);
+                framework.sync();
                 
                 frames++;
                 if (System.currentTimeMillis() - now > 1000) {

ferox-renderer/ferox-renderer-jogl/src/test/java/com/ferox/renderer/impl/jogl/SelfDestructTest.java

 
 public class SelfDestructTest {
     public static void main(String[] args) throws Exception {
-        final Framework f = JoglFramework.create(1, false, false, true, false);
+        final Framework f = JoglFramework.create(false, false, true, false);
         System.out.println("framework created");
         final OnscreenSurface surface = f.createSurface(new OnscreenSurfaceOptions()
             .setFullscreenMode(new DisplayMode(1024, 768, PixelFormat.RGB_24BIT))
                 f.destroy();
                 return "finished";
             }
-        }, "woop").get();
+        }).get();
         
         System.out.println(result);
     }

ferox-renderer/ferox-renderer-lwjgl/src/main/java/com/ferox/renderer/impl/lwjgl/LwjglFixedFunctionRenderer.java

     private boolean initialized;
     
     // math object transfer objects
-    private final FloatBuffer matrixBuffer;
-    private final FloatBuffer vector4Buffer;
+    private final FloatBuffer transferBuffer;
     
     // state tracking
     private boolean alphaTestEnabled;
         
         initialized = false;
         
-        matrixBuffer = BufferUtil.newFloatBuffer(16);
-        vector4Buffer = BufferUtil.newFloatBuffer(4);
+        transferBuffer = BufferUtil.newFloatBuffer(16);
         alphaTestEnabled = false;
     }
     
 
     @Override
     protected void glSetMatrix(@Const Matrix4 matrix) {
-        matrix.get(matrixBuffer, 0, false);
-        GL11.glLoadMatrix(matrixBuffer);
+        matrix.get(transferBuffer, 0, false);
+        GL11.glLoadMatrix(transferBuffer);
     }
 
     @Override
 
     @Override
     protected void glFogColor(@Const Vector4 color) {
-        color.get(vector4Buffer, 0);
-        GL11.glFog(GL11.GL_FOG_COLOR, vector4Buffer);
+        color.get(transferBuffer, 0);
+        GL11.glFog(GL11.GL_FOG_COLOR, transferBuffer);
     }
 
     @Override
 
     @Override
     protected void glGlobalLighting(@Const Vector4 ambient) {
-        ambient.get(vector4Buffer, 0);
-        GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, vector4Buffer);
+        ambient.get(transferBuffer, 0);
+        GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, transferBuffer);
     }
     
     @Override
     protected void glLightColor(int light, LightColor lc, @Const Vector4 color) {
-        color.get(vector4Buffer, 0);
+        color.get(transferBuffer, 0);
         int c = getGLLight(lc);
-        GL11.glLight(GL11.GL_LIGHT0 + light, c, vector4Buffer);
+        GL11.glLight(GL11.GL_LIGHT0 + light, c, transferBuffer);
     }
 
     @Override
 
     @Override
     protected void glLightPosition(int light, @Const Vector4 pos) {
-        pos.get(vector4Buffer, 0);
-        GL11.glLight(GL11.GL_LIGHT0 + light, GL11.GL_POSITION, vector4Buffer);
+        pos.get(transferBuffer, 0);
+        GL11.glLight(GL11.GL_LIGHT0 + light, GL11.GL_POSITION, transferBuffer);
     }
 
     @Override
     protected void glLightDirection(int light, @Const Vector3 dir) {
-        dir.get(vector4Buffer, 0);
-        GL11.glLight(GL11.GL_LIGHT0 + light, GL11.GL_SPOT_DIRECTION, vector4Buffer);
+        dir.get(transferBuffer, 0);
+        GL11.glLight(GL11.GL_LIGHT0 + light, GL11.GL_SPOT_DIRECTION, transferBuffer);
     }
 
     @Override
         if (component == LightColor.DIFFUSE) {
             GL11.glColor4d(color.x, color.y, color.z, color.w);
         } else {
-            color.get(vector4Buffer, 0);
-            GL11.glMaterial(GL11.GL_FRONT_AND_BACK, c, vector4Buffer);
+            color.get(transferBuffer, 0);
+            GL11.glMaterial(GL11.GL_FRONT_AND_BACK, c, transferBuffer);
         }
     }
 
 
     @Override
     protected void glTextureColor(@Const Vector4 color) {
-        color.get(vector4Buffer, 0);
-        GL11.glTexEnv(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_COLOR, vector4Buffer);
+        color.get(transferBuffer, 0);
+        GL11.glTexEnv(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_COLOR, transferBuffer);
     }
 
     @Override
 
     @Override
     protected void glTexEyePlane(TexCoord coord, @Const Vector4 plane) {
-        plane.get(vector4Buffer, 0);
+        plane.get(transferBuffer, 0);
         int tc = Utils.getGLTexCoord(coord, false);
-        GL11.glTexGen(tc, GL11.GL_EYE_PLANE, vector4Buffer);
+        GL11.glTexGen(tc, GL11.GL_EYE_PLANE, transferBuffer);
     }
 
     @Override
     protected void glTexObjPlane(TexCoord coord, @Const Vector4 plane) {
-        plane.get(vector4Buffer, 0);
+        plane.get(transferBuffer, 0);
         int tc = Utils.getGLTexCoord(coord, false);
-        GL11.glTexGen(tc, GL11.GL_OBJECT_PLANE, vector4Buffer);
+        GL11.glTexGen(tc, GL11.GL_OBJECT_PLANE, transferBuffer);
     }
 
     @Override