Commits

Michael Ludwig committed 4bc7a1e

Checkpoint

Comments (0)

Files changed (10)

ferox-demos/src/main/java/com/ferox/physics/PhysicsTest.java

 import com.ferox.math.Vector4;
 import com.ferox.physics.collision.CollisionBody;
 import com.ferox.physics.dynamics.RigidBody;
+import com.ferox.renderer.Framework;
 import com.ferox.renderer.OnscreenSurface;
 import com.ferox.renderer.Renderer;
 import com.ferox.renderer.geom.Box;
         wall.add(Renderable.class).setGeometry(bottomWall)
             .setDrawStyle(Renderer.DrawStyle.SOLID, Renderer.DrawStyle.NONE);
         wall.add(LambertianDiffuseModel.class).setColor(new ColorRGB(0.5, 0.5, 0.5));
-        wall.add(DiffuseColorMap.class).setTexture(charSet.getTexture());
+        //        wall.add(DiffuseColorMap.class).setTexture(charSet.getTexture());
 
         wall.add(CollisionBody.class).setShape(new com.ferox.physics.collision.shape.Box(BOUNDS, 1, BOUNDS))
             .setTransform(new Matrix4().setIdentity().setCol(3, new Vector4(0, -.5, 0, 1)));
 
         // a directed light, which casts shadows
         Entity inf = system.addEntity();
-        inf.add(Light.class).setColor(new ColorRGB(1, 1, 1)).setShadowCaster(false)
-           .setCutoffAngle(Double.NaN);
+        inf.add(Light.class).setColor(new ColorRGB(1, 1, 1)).setShadowCaster(true).setCutoffAngle(Double.NaN);
         inf.get(Transform.class)
            .setMatrix(new Matrix4().lookAt(new Vector3(), new Vector3(15, 15, 15), new Vector3(0, 1, 0)));
     }
 
     public static void main(String[] args) {
+        Framework.Factory.enableDebugMode();
         new PhysicsTest().run();
     }
 }

ferox-demos/src/main/java/com/ferox/util/ApplicationStub.java

 
         int numFrames = 0;
         long last = System.currentTimeMillis();
-        while (!surface.isDestroyed()) {
-            io.process();
-            renderFrame(surface);
-            numFrames++;
+        try {
+            while (!surface.isDestroyed()) {
+                io.process();
+                renderFrame(surface);
+                numFrames++;
 
-            if (fps != null) {
-                fps.render(surface);
+                if (fps != null) {
+                    fps.render(surface);
+                }
+                if (profile != null) {
+                    profile.render(surface);
+                }
+                framework.flush(surface);
+                framework.sync();
+
+                long now = System.currentTimeMillis();
+                if (now - last > 100) {
+                    // it's been a 10th of a second
+                    double dt = (now - last) / 1e3;
+                    if (showFPS) {
+                        fps = formatFPS((numFrames / dt), charSet);
+                    } else {
+                        fps = null;
+                    }
+
+                    if (showProfiling) {
+                        profile = formatProfiling(r.totalMemory() - r.freeMemory(), r.totalMemory(), charSet);
+                    } else {
+                        profile = null;
+                    }
+
+                    last = now;
+                    numFrames = 0;
+                }
             }
-            if (profile != null) {
-                profile.render(surface);
-            }
-            framework.flush(surface);
-            framework.sync();
-
-            long now = System.currentTimeMillis();
-            if (now - last > 100) {
-                // it's been a 10th of a second
-                double dt = (now - last) / 1e3;
-                if (showFPS) {
-                    fps = formatFPS((numFrames / dt), charSet);
-                } else {
-                    fps = null;
-                }
-
-                if (showProfiling) {
-                    profile = formatProfiling(r.totalMemory() - r.freeMemory(), r.totalMemory(), charSet);
-                } else {
-                    profile = null;
-                }
-
-                last = now;
-                numFrames = 0;
-            }
+        } finally {
+            framework.destroy();
         }
     }
 

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

  *
  */
 public class JoglFixedFunctionTest {
+    static double x = 0;
+
     public static void main(String[] args) throws Exception {
-        Framework framework = Framework.Factory.create();
-        final OnscreenSurface s = framework.createSurface(new OnscreenSurfaceOptions().windowed(500, 500));
+        final Framework framework = Framework.Factory.create();
+        final OnscreenSurface s = framework
+                .createSurface(new OnscreenSurfaceOptions().windowed(500, 500).withDepthBuffer(24));
         s.setTitle("Hello World");
-        s.setVSyncEnabled(true);
+        //        s.setVSyncEnabled(true);
 
+        //                final Geometry box = Sphere.create(framework, 1.5, 8);
         final Geometry box = Box.create(framework, 3.0);
 
         try {
                         r.clear(true, true, true);
 
                         Frustum view = new Frustum(60.0, 1.0, 1.0, 1000.0);
-                        view.setOrientation(new Vector3(0, 0, 150), new Vector3(0, 0, -1),
+                        view.setOrientation(new Vector3(0, 0, 25), new Vector3(0, 0, -1),
                                             new Vector3(0, 1, 0));
                         r.setProjectionMatrix(view.getProjectionMatrix());
                         r.setModelViewMatrix(view.getViewMatrix());
 
                         r.setLightingEnabled(true);
                         r.setLightEnabled(0, true);
-                        r.setLightColor(0, new Vector4(.4, .2, 0, 1), new Vector4(.4, .2, 0, 1),
-                                        new Vector4(1, 1, 1, 1));
-                        r.setLightPosition(0, new Vector4(50, 50, 50, 1));
+                        //                        r.setGlobalAmbientLight(new Vector4(.3, .3, .3, 1.0));
 
-                        r.setMaterialDiffuse(new Vector4(.8, .8, .8, 1));
+                        r.setLightColor(0, new Vector4(1, 1, 1, 1), new Vector4(1, 1, 1, 1), new Vector4());
+                        r.setLightPosition(0, new Vector4(0, 0, 25, 1));
+                        //                        r.setSpotlight(0, new Vector3(0, 0, -1), 15, 40);
+
+                        r.setMaterialDiffuse(new Vector4(.5, 0, .5, 1));
+                        r.setMaterialAmbient(new Vector4(.2, .2, .2, 1));
 
                         r.setNormals(box.getNormals());
                         r.setVertices(box.getVertices());
                         r.setIndices(box.getIndices());
 
+                        r.setDepthTest(Renderer.Comparison.GREATER);
+                        r.setDepthTest(Renderer.Comparison.LESS);
 
-                        Matrix4 m = new Matrix4();
+                        Matrix4 m = new Matrix4().setIdentity();
                         Vector4 t = new Vector4();
-                        for (int i = 0; i < 10000; i++) {
-                            t.set(Math.random() * 100 - 50, Math.random() * 100 - 50,
-                                  Math.random() * 100 - 50, 1);
-                            m.setIdentity().setCol(3, t);
-                            r.setModelViewMatrix(m.mul(view.getViewMatrix(), m));
 
-                            r.render(box.getPolygonType(), box.getIndexOffset(), box.getIndexCount());
+                        for (int y = 0; y < 5; y++) {
+                            for (int x = 0; x < 5; x++) {
+                                t.set(JoglFixedFunctionTest.x + 2.8 * (x - 2), 2.8 * (y - 2), 0, 1);
+                                m.setCol(3, t);
+
+                                r.setModelViewMatrix(m.mul(view.getViewMatrix(), m));
+                                r.render(box.getPolygonType(), box.getIndexOffset(), box.getIndexCount());
+                            }
+                        }
+                        x += 0.001;
+                        if (x > 10) {
+                            x = -10;
                         }
 
                         c.flush();

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

 package com.ferox.renderer.impl.jogl;
 
+import com.ferox.math.Matrix4;
+import com.ferox.math.Vector3;
+import com.ferox.math.Vector4;
+import com.ferox.math.bounds.Frustum;
 import com.ferox.renderer.*;
+import com.ferox.renderer.geom.Box;
+import com.ferox.renderer.geom.Geometry;
 
 /**
  *
  */
 public class JoglGlslTest {
+    public static final String VERTEX_120 = "#version 120\n" +
+                                            "attribute vec4 vertex;\n" +
+                                            "attribute vec4 normal;\n" +
+                                            "varying vec4 color;\n" +
+                                            "uniform mat4 projection;\n" +
+                                            "uniform mat4 modelview;\n" +
+                                            "void main() {\n" +
+                                            "color = normal * 0.5 + vec4(0.5);\n" +
+                                            "gl_Position = projection * modelview * vertex;\n" +
+                                            "}\n";
+    public static final String FRAGMENT_120 = "#version 120\n" +
+                                              "varying vec4 color;\n" +
+                                              "void main() {\n" +
+                                              "gl_FragColor = color;\n" +
+                                              "}\n";
+
+    public static final String VERTEX_150 = "#version 150\n" +
+                                            "in vec4 vertex;\n" +
+                                            "in vec4 normal;\n" +
+                                            "out vec4 color;\n" +
+                                            "uniform mat4 projection;\n" +
+                                            "uniform mat4 modelview;\n" +
+                                            "void main() {\n" +
+                                            "color = normal * 0.5 + vec4(0.5);\n" +
+                                            "gl_Position = projection * modelview * vertex;\n" +
+                                            "}\n";
+    public static final String FRAGMENT_150 = "#version 150\n" +
+                                              "in vec4 color;\n" +
+                                              "out vec4 fColor;\n" +
+                                              "void main() {\n" +
+                                              "fColor = color;\n" +
+                                              "}\n";
+
+    static double x = 0;
+
     public static void main(String[] args) throws Exception {
-        Framework f = Framework.Factory.create();
+        final Framework framework = Framework.Factory.create();
+        final OnscreenSurface s = framework
+                .createSurface(new OnscreenSurfaceOptions().windowed(500, 500).withDepthBuffer(24));
+        s.setTitle("Hello World");
+        s.setVSyncEnabled(false);
+
+        //        final Geometry box = Sphere.create(framework, 1.5, 8);
+        final Geometry box = Box.create(framework, 3.0);
+
+        final Shader shader;
+
+        if (framework.getCapabilities().getMajorVersion() >= 3) {
+            shader = framework.newShader().withVertexShader(VERTEX_150).withFragmentShader(FRAGMENT_150)
+                              .build();
+        } else {
+            shader = framework.newShader().withVertexShader(VERTEX_120).withFragmentShader(FRAGMENT_120)
+                              .build();
+        }
+        final Shader.Uniform modelview = shader.getUniform("modelview");
+        final Shader.Uniform projection = shader.getUniform("projection");
+        final Shader.Attribute vertex = shader.getAttribute("vertex");
+        final Shader.Attribute normal = shader.getAttribute("normal");
+
         try {
-            String vSrc = f.getCapabilities().getGlslVersion() == 150 ? VERTEX_SHADER_150 : VERTEX_SHADER_120;
-            String fSrc =
-                    f.getCapabilities().getGlslVersion() == 150 ? FRAGMENT_SHADER_150 : FRAGMENT_SHADER_120;
+            while (!s.isDestroyed()) {
+                framework.invoke(new Task<Void>() {
+                    @Override
+                    public Void run(HardwareAccessLayer access) {
+                        Context c = access.setActiveSurface(s);
+                        GlslRenderer r = c.getGlslRenderer();
+                        r.clear(true, true, true);
 
-            Shader s = f.newShader().withVertexShader(vSrc).withFragmentShader(fSrc).build();
+                        Frustum view = new Frustum(60.0, 1.0, 1.0, 1000.0);
+                        view.setOrientation(new Vector3(0, 0, 25), new Vector3(0, 0, -1),
+                                            new Vector3(0, 1, 0));
 
-            for (Shader.Uniform u : s.getUniforms()) {
-                System.out.println(u);
-            }
+                        r.setShader(shader);
+                        r.setUniform(modelview, view.getViewMatrix());
+                        r.setUniform(projection, view.getProjectionMatrix());
 
-            for (Shader.Attribute a : s.getAttributes()) {
-                System.out.println(a);
-            }
+                        r.bindAttribute(vertex, box.getVertices());
+                        r.bindAttribute(normal, box.getNormals());
+                        r.setIndices(box.getIndices());
 
-            if (f.getCapabilities().getMajorVersion() >= 3) {
-                final OnscreenSurface w = f.createSurface(new OnscreenSurfaceOptions());
-                f.invoke(new Task<Object>() {
-                    @Override
-                    public Object run(HardwareAccessLayer access) {
-                        access.setActiveSurface(w).getFixedFunctionRenderer();
+                        r.setDrawStyle(Renderer.DrawStyle.SOLID, Renderer.DrawStyle.LINE);
+                        r.setDepthTest(Renderer.Comparison.ALWAYS);
+                        r.setDepthTest(Renderer.Comparison.LESS);
+
+                        Matrix4 m = new Matrix4().setIdentity();
+                        Vector4 t = new Vector4();
+
+                        for (int y = 0; y < 5; y++) {
+                            for (int x = 0; x < 5; x++) {
+                                t.set(JoglGlslTest.x + 2.8 * (x - 2), 2.8 * (y - 2), 0, 1);
+                                m.setCol(3, t);
+
+                                r.setUniform(modelview, m.mul(view.getViewMatrix(), m));
+                                r.render(box.getPolygonType(), box.getIndexOffset(), box.getIndexCount());
+                            }
+                        }
+                        x += 0.001;
+                        if (x > 10) {
+                            x = -10;
+                        }
+
+                        c.flush();
+
                         return null;
                     }
                 }).get();
             }
         } finally {
-            f.destroy();
+            framework.destroy();
         }
     }
-
-    public static final String VERTEX_SHADER_120 = "#version 120\n" +
-                                                   "attribute vec3 vertices;\n" +
-                                                   "attribute vec4 used;\n" +
-                                                   "attribute vec2 moarattrs;\n" +
-                                                   "void main() {\n" +
-                                                   "gl_Position = used + vec4(moarattrs, 1.0, 1.0) + vec4(vertices, 1.0);\n" +
-                                                   "}\n";
-
-    public static final String FRAGMENT_SHADER_120 = "#version 120\n" +
-                                                     "struct Foo {\n" +
-                                                     "vec3 bar[3];\n" +
-                                                     "vec2 arg;\n" +
-                                                     "};\n" +
-                                                     "uniform Foo vars[3];\n" +
-                                                     "uniform vec3 moar[5];\n" +
-                                                     "void main() {\n" +
-                                                     "vec4 color = vec4(0.0, 0.0, 0.0, 1.0);\n" +
-                                                     "color.x = vars[0].bar[0].x + vars[1].bar[1].x + vars[0].arg.x + vars[1].arg.x;\n" +
-                                                     "color.y = vars[0].bar[1].y + vars[1].bar[2].y + vars[0].arg.y + vars[1].arg.y;\n" +
-                                                     "color.z = vars[0].bar[2].z + vars[1].bar[0].z;\n" +
-                                                     "color = color + vec4(moar[0], 1.0) + vec4(moar[3], 1.0);\n" +
-                                                     "gl_FragColor = color;\n" +
-                                                     "}\n";
-
-    public static final String VERTEX_SHADER_150 = "#version 150\n" +
-                                                   "in mat3 vertices[2];\n" +
-                                                   "in vec4 used;\n" +
-                                                   "in vec2 moarattrs;\n" +
-                                                   "void main() {\n" +
-                                                   "gl_Position = vec4(moarattrs, 1.0, 1.0) +vec4(vertices[0][0], 1.0) + used;\n" +
-                                                   "}\n";
-
-    public static final String FRAGMENT_SHADER_150 = "#version 150\n" +
-                                                     "struct Foo {\n" +
-                                                     "vec3 bar[3];\n" +
-                                                     "vec2 arg;\n" +
-                                                     "};\n" +
-                                                     "uniform Foo vars[3];\n" +
-                                                     "uniform vec3 moar[5];\n" +
-                                                     "out vec4 color;\n" +
-                                                     "void main() {\n" +
-                                                     "vec4 color = vec4(0.0, 0.0, 0.0, 1.0);\n" +
-                                                     "color.x = vars[0].bar[0].x + vars[1].bar[1].x + vars[0].arg.x + vars[1].arg.x;\n" +
-                                                     "color.y = vars[0].bar[1].y + vars[1].bar[2].y + vars[0].arg.y + vars[1].arg.y;\n" +
-                                                     "color.z = vars[0].bar[2].z + vars[1].bar[0].z;\n" +
-                                                     "color = color + vec4(moar[0], 1.0) + vec4(moar[3], 1.0);\n" +
-                                                     "}\n";
 }

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

             LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 7)) {
             // for mac we need to explicitly select this context profile to get 3+
             attribs = new ContextAttribs(3, 2).withProfileCore(true);
+            //            attribs = null;
         } else {
             // for everyone else, it should just automatically select the highest opengl version
             // FIXME I think we should have better profile support because the presence of the compatibility

ferox-renderer-lwjgl/src/test/java/com/ferox/renderer/impl/lwjgl/LwjglFixedFunctionTest.java

  *
  */
 public class LwjglFixedFunctionTest {
+    static double x = 0;
+
     public static void main(String[] args) throws Exception {
         final Framework framework = Framework.Factory.create();
-        final OnscreenSurface s = framework.createSurface(new OnscreenSurfaceOptions().windowed(500, 500));
+        final OnscreenSurface s = framework
+                .createSurface(new OnscreenSurfaceOptions().windowed(500, 500).withDepthBuffer(24));
         s.setTitle("Hello World");
-        s.setVSyncEnabled(true);
 
+        //                final Geometry box = Sphere.create(framework, 1.5, 16);
         final Geometry box = Box.create(framework, 3.0);
 
         try {
                     public Void run(HardwareAccessLayer access) {
                         Context c = access.setActiveSurface(s);
                         FixedFunctionRenderer r = c.getFixedFunctionRenderer();
-                        r.clear(true, true, true);
+                        r.clear(true, true, true, new Vector4(.3, .2, .5, 1), 1.0, 0);
 
                         Frustum view = new Frustum(60.0, 1.0, 1.0, 1000.0);
-                        view.setOrientation(new Vector3(0, 0, 150), new Vector3(0, 0, -1),
+                        view.setOrientation(new Vector3(0, 0, 25), new Vector3(0, 0, -1),
                                             new Vector3(0, 1, 0));
                         r.setProjectionMatrix(view.getProjectionMatrix());
                         r.setModelViewMatrix(view.getViewMatrix());
 
                         r.setLightingEnabled(true);
                         r.setLightEnabled(0, true);
-                        r.setLightColor(0, new Vector4(.4, .2, 0, 1), new Vector4(.4, .2, 0, 1),
+                        //                        r.setGlobalAmbientLight(new Vector4(.3, .3, .3, 1.0));
+
+                        r.setLightColor(0, new Vector4(1, 1, 1, 1), new Vector4(1, 1, 1, 1),
                                         new Vector4(1, 1, 1, 1));
-                        r.setLightPosition(0, new Vector4(50, 50, 50, 1));
+                        r.setLightPosition(0, new Vector4(0, 0, 25, 1));
+                        //                        r.setSpotlight(0, new Vector3(0, 0, -1), 15, 40);
 
-                        r.setMaterialDiffuse(new Vector4(.8, .8, .8, 1));
+                        r.setMaterialDiffuse(new Vector4(.5, 0, .5, 1));
+                        r.setMaterialAmbient(new Vector4(.2, .2, .2, 1));
+                        r.setMaterialSpecular(new Vector4(.2, .9, .2, 1));
+                        r.setMaterialShininess(10.0);
 
                         r.setNormals(box.getNormals());
                         r.setVertices(box.getVertices());
                         r.setIndices(box.getIndices());
 
+                        r.setDrawStyle(Renderer.DrawStyle.SOLID, Renderer.DrawStyle.LINE);
 
-                        Matrix4 m = new Matrix4();
+                        Matrix4 m = new Matrix4().setIdentity();
                         Vector4 t = new Vector4();
-                        for (int i = 0; i < 10000; i++) {
-                            t.set(Math.random() * 100 - 50, Math.random() * 100 - 50,
-                                  Math.random() * 100 - 50, 1);
-                            m.setIdentity().setCol(3, t);
-                            r.setModelViewMatrix(m.mul(view.getViewMatrix(), m));
 
-                            r.render(box.getPolygonType(), box.getIndexOffset(), box.getIndexCount());
+                        for (int z = 0; z < 5; z++) {
+                            for (int y = 0; y < 5; y++) {
+                                for (int x = 0; x < 5; x++) {
+                                    t.set(LwjglFixedFunctionTest.x + 3.5 * (x - 2), 3.5 * (y - 2),
+                                          3.5 * (z - 2), 1);
+                                    m.setCol(3, t);
+
+                                    r.setModelViewMatrix(m.mul(view.getViewMatrix(), m));
+                                    r.render(box.getPolygonType(), box.getIndexOffset(), box.getIndexCount());
+                                }
+                            }
+                        }
+                        x += 0.01;
+                        if (x > 20) {
+                            x = -20;
                         }
 
                         c.flush();

ferox-renderer-lwjgl/src/test/java/com/ferox/renderer/impl/lwjgl/LwjglGlslTest.java

 package com.ferox.renderer.impl.lwjgl;
 
+import com.ferox.math.Matrix4;
+import com.ferox.math.Vector3;
+import com.ferox.math.Vector4;
+import com.ferox.math.bounds.Frustum;
 import com.ferox.renderer.*;
+import com.ferox.renderer.geom.Box;
+import com.ferox.renderer.geom.Geometry;
 
 /**
  *
  */
 public class LwjglGlslTest {
+    public static final String VERTEX_120 = "#version 120\n" +
+                                            "attribute vec4 vertex;\n" +
+                                            "attribute vec4 normal;\n" +
+                                            "varying vec4 color;\n" +
+                                            "uniform mat4 projection;\n" +
+                                            "uniform mat4 modelview;\n" +
+                                            "void main() {\n" +
+                                            "color = normal * 0.5 + vec4(0.5);\n" +
+                                            "gl_Position = projection * modelview * vertex;\n" +
+                                            "}\n";
+    public static final String FRAGMENT_120 = "#version 120\n" +
+                                              "varying vec4 color;\n" +
+                                              "void main() {\n" +
+                                              "gl_FragColor = color;\n" +
+                                              "}\n";
+
+    public static final String VERTEX_150 = "#version 150\n" +
+                                            "in vec4 vertex;\n" +
+                                            "in vec4 normal;\n" +
+                                            "out vec4 color;\n" +
+                                            "uniform mat4 projection;\n" +
+                                            "uniform mat4 modelview;\n" +
+                                            "void main() {\n" +
+                                            "color = normal * 0.5 + vec4(0.5);\n" +
+                                            "gl_Position = projection * modelview * vertex;\n" +
+                                            "}\n";
+    public static final String FRAGMENT_150 = "#version 150\n" +
+                                              "in vec4 color;\n" +
+                                              "out vec4 fColor;\n" +
+                                              "void main() {\n" +
+                                              "fColor = color;\n" +
+                                              "}\n";
+
+    static double x = 0;
+
     public static void main(String[] args) throws Exception {
-        Framework f = Framework.Factory.create();
+        final Framework framework = Framework.Factory.create();
+        final OnscreenSurface s = framework
+                .createSurface(new OnscreenSurfaceOptions().windowed(500, 500).withDepthBuffer(24));
+        s.setTitle("Hello World");
+        s.setVSyncEnabled(true);
+
+        //        final Geometry box = Sphere.create(framework, 1.5, 8);
+        final Geometry box = Box.create(framework, 3.0);
+
+        final Shader shader;
+
+        if (framework.getCapabilities().getMajorVersion() >= 3) {
+            shader = framework.newShader().withVertexShader(VERTEX_150).withFragmentShader(FRAGMENT_150)
+                              .build();
+        } else {
+            shader = framework.newShader().withVertexShader(VERTEX_120).withFragmentShader(FRAGMENT_120)
+                              .bindColorBuffer("fColor", 0).build();
+        }
+        final Shader.Uniform modelview = shader.getUniform("modelview");
+        final Shader.Uniform projection = shader.getUniform("projection");
+        final Shader.Attribute vertex = shader.getAttribute("vertex");
+        final Shader.Attribute normal = shader.getAttribute("normal");
+
         try {
-            String vSrc = f.getCapabilities().getGlslVersion() == 150 ? VERTEX_SHADER_150 : VERTEX_SHADER_120;
-            String fSrc =
-                    f.getCapabilities().getGlslVersion() == 150 ? FRAGMENT_SHADER_150 : FRAGMENT_SHADER_120;
+            while (!s.isDestroyed()) {
+                framework.invoke(new Task<Void>() {
+                    @Override
+                    public Void run(HardwareAccessLayer access) {
+                        Context c = access.setActiveSurface(s);
+                        GlslRenderer r = c.getGlslRenderer();
+                        r.clear(true, true, true);
 
-            Shader s = f.newShader().withVertexShader(vSrc).withFragmentShader(fSrc).build();
+                        Frustum view = new Frustum(60.0, 1.0, 1.0, 25.0);
+                        view.setOrientation(new Vector3(0, 0, 25), new Vector3(0, 0, -1),
+                                            new Vector3(0, 1, 0));
 
-            for (Shader.Uniform u : s.getUniforms()) {
-                System.out.println(u);
-            }
+                        r.setShader(shader);
+                        r.setUniform(modelview, view.getViewMatrix());
+                        r.setUniform(projection, view.getProjectionMatrix());
 
-            for (Shader.Attribute a : s.getAttributes()) {
-                System.out.println(a);
-            }
+                        r.bindAttribute(vertex, box.getVertices());
+                        r.bindAttribute(normal, box.getNormals());
+                        r.setIndices(box.getIndices());
 
-            if (f.getCapabilities().getMajorVersion() >= 3) {
-                final OnscreenSurface w = f.createSurface(new OnscreenSurfaceOptions());
-                f.invoke(new Task<Object>() {
-                    @Override
-                    public Object run(HardwareAccessLayer access) {
-                        access.setActiveSurface(w).getFixedFunctionRenderer();
+                        r.setDrawStyle(Renderer.DrawStyle.SOLID, Renderer.DrawStyle.LINE);
+                        //                        r.setDepthTest(Renderer.Comparison.ALWAYS);
+
+                        Matrix4 m = new Matrix4().setIdentity();
+                        Vector4 t = new Vector4();
+
+                        for (int z = 0; z < 5; z++) {
+                            for (int y = 0; y < 5; y++) {
+                                for (int x = 0; x < 5; x++) {
+                                    t.set(LwjglGlslTest.x + 3.5 * (x - 2), 3.5 * (y - 2), 3.5 * (z - 2), 1);
+                                    m.setCol(3, t);
+
+                                    r.setUniform(modelview, m.mul(view.getViewMatrix(), m));
+                                    r.render(box.getPolygonType(), box.getIndexOffset(), box.getIndexCount());
+                                }
+                            }
+                        }
+                        x += 0.001;
+                        if (x > 20) {
+                            x = -20;
+                        }
+
+                        c.flush();
+
                         return null;
                     }
                 }).get();
             }
-        } catch (Exception e) {
-            System.err.println("THIS IS THE MAIN ONE!");
-            e.printStackTrace();
         } finally {
-            f.destroy();
+            framework.destroy();
         }
     }
-
-    public static final String VERTEX_SHADER_120 = "#version 120\n" +
-                                                   "attribute vec3 vertices;\n" +
-                                                   "attribute vec4 used;\n" +
-                                                   "attribute vec2 moarattrs;\n" +
-                                                   "void main() {\n" +
-                                                   "gl_Position = used + vec4(moarattrs, 1.0, 1.0) + vec4(vertices, 1.0);\n" +
-                                                   "}\n";
-
-    public static final String FRAGMENT_SHADER_120 = "#version 120\n" +
-                                                     "struct Foo {\n" +
-                                                     "vec3 bar[3];\n" +
-                                                     "vec2 arg;\n" +
-                                                     "};\n" +
-                                                     "uniform Foo vars[3];\n" +
-                                                     "uniform vec3 moar[5];\n" +
-                                                     "void main() {\n" +
-                                                     "vec4 color = vec4(0.0, 0.0, 0.0, 1.0);\n" +
-                                                     "color.x = vars[0].bar[0].x + vars[1].bar[1].x + vars[0].arg.x + vars[1].arg.x;\n" +
-                                                     "color.y = vars[0].bar[1].y + vars[1].bar[2].y + vars[0].arg.y + vars[1].arg.y;\n" +
-                                                     "color.z = vars[0].bar[2].z + vars[1].bar[0].z;\n" +
-                                                     "color = color + vec4(moar[0], 1.0) + vec4(moar[3], 1.0);\n" +
-                                                     "gl_FragColor = color;\n" +
-                                                     "}\n";
-
-    public static final String VERTEX_SHADER_150 = "#version 150\n" +
-                                                   "in vec3 vertices[2];\n" +
-                                                   "in vec4 used;\n" +
-                                                   "in vec2 moarattrs;\n" +
-                                                   "void main() {\n" +
-                                                   "gl_Position = vec4(moarattrs, 1.0, 1.0) +vec4(vertices[0], 1.0) + used;\n" +
-                                                   "}\n";
-
-    public static final String FRAGMENT_SHADER_150 = "#version 150\n" +
-                                                     "struct Foo {\n" +
-                                                     "vec3 bar[3];\n" +
-                                                     "vec2 arg;\n" +
-                                                     "};\n" +
-                                                     "uniform Foo vars[3];\n" +
-                                                     "uniform vec3 moar[5];\n" +
-                                                     "out vec4 color;\n" +
-                                                     "void main() {\n" +
-                                                     "vec4 color = vec4(0.0, 0.0, 0.0, 1.0);\n" +
-                                                     "color.x = vars[0].bar[0].x + vars[1].bar[0].x + vars[0].arg.x + vars[1].arg.x;\n" +
-                                                     "color.y = vars[0].bar[0].y + vars[1].bar[0].y + vars[0].arg.y + vars[1].arg.y;\n" +
-                                                     "color.z = vars[0].bar[0].z + vars[1].bar[0].z;\n" +
-                                                     "color = color + vec4(moar[0], 1.0) + vec4(moar[3], 1.0);\n" +
-                                                     "}\n";
 }

ferox-renderer/src/main/java/com/ferox/renderer/impl/AbstractFixedFunctionRenderer.java

  */
 public abstract class AbstractFixedFunctionRenderer extends AbstractRenderer
         implements FixedFunctionRenderer {
-    private static final Matrix4 IDENTITY = new Matrix4();
+    private static final Matrix4 IDENTITY = new Matrix4().setIdentity();
     private static final Vector4 DEFAULT_MAT_D_COLOR = new Vector4(.8, .8, .8, 1);
 
     protected final FixedFunctionState state;

ferox-renderer/src/main/java/com/ferox/renderer/impl/ShaderFixedFunctionEmulator.java

             glsl.setUniformArray(sampler1D, tex, image);
             glsl.setUniformArray(texConfig, tex, 0);
             glsl.setUniformArray(depthComparison, tex, -1);
-            System.out.println("setting tex config to 1D for : " + tex);
         } else if (image instanceof Texture2D) {
             glsl.setUniformArray(sampler2D, tex, image);
             glsl.setUniformArray(texConfig, tex, 1);
             glsl.setUniformArray(depthComparison, tex, -1);
-            System.out.println("setting tex config to 2D for : " + tex);
         } else if (image instanceof Texture3D) {
             glsl.setUniformArray(sampler3D, tex, image);
             glsl.setUniformArray(texConfig, tex, 2);
             glsl.setUniformArray(depthComparison, tex, -1);
-            System.out.println("setting tex config to 3D for : " + tex);
         } else if (image instanceof TextureCubeMap) {
             glsl.setUniformArray(samplerCube, tex, image);
             glsl.setUniformArray(texConfig, tex, 3);
             glsl.setUniformArray(depthComparison, tex, -1);
-            System.out.println("setting tex config to cube for : " + tex);
         } else if (image instanceof DepthMap2D) {
             glsl.setUniformArray(sampler2D, tex, image);
             glsl.setUniformArray(texConfig, tex, 1);
             DepthMap2D map = (DepthMap2D) image;
             int compare = (map.getDepthComparison() == null ? -1 : map.getDepthComparison().ordinal());
             glsl.setUniformArray(depthComparison, tex, compare);
-            System.out.println("setting tex config to depth2d for : " + tex);
-
         } else {
             glsl.setUniformArray(texConfig, tex, -1);
         }
     public void setTextureCombineRGB(int tex, CombineFunction function, CombineSource src0,
                                      CombineOperand op0, CombineSource src1, CombineOperand op1,
                                      CombineSource src2, CombineOperand op2) {
-        glsl.setUniform(combineFuncRGB, tex, function.ordinal());
-        glsl.setUniform(combineSrcRGB, tex, src0.ordinal(), src1.ordinal(), src2.ordinal());
-        glsl.setUniform(combineOpRGB, tex, op0.ordinal(), op1.ordinal(), op2.ordinal());
+        glsl.setUniformArray(combineFuncRGB, tex, function.ordinal());
+        glsl.setUniformArray(combineSrcRGB, tex, src0.ordinal(), src1.ordinal(), src2.ordinal());
+        glsl.setUniformArray(combineOpRGB, tex, op0.ordinal(), op1.ordinal(), op2.ordinal());
     }
 
     @Override
     public void setTextureCombineAlpha(int tex, CombineFunction function, CombineSource src0,
                                        CombineOperand op0, CombineSource src1, CombineOperand op1,
                                        CombineSource src2, CombineOperand op2) {
-        glsl.setUniform(combineFuncAlpha, tex, function.ordinal());
-        glsl.setUniform(combineSrcAlpha, tex, src0.ordinal(), src1.ordinal(), src2.ordinal());
-        glsl.setUniform(combineOpAlpha, tex, op0.ordinal(), op1.ordinal(), op2.ordinal());
+        glsl.setUniformArray(combineFuncAlpha, tex, function.ordinal());
+        glsl.setUniformArray(combineSrcAlpha, tex, src0.ordinal(), src1.ordinal(), src2.ordinal());
+        glsl.setUniformArray(combineOpAlpha, tex, op0.ordinal(), op1.ordinal(), op2.ordinal());
     }
 
     @Override

ferox-renderer/src/main/resources/com/ferox/renderer/impl/ffp.frag

     switch(uTexConfig[tex]) {
         case 0: // 1D
             float coord1 = vTexCoord[tex].s / vTexCoord[tex].q;
-            //return texture(uTex1D[tex], coord1);
-            return vec4(1.0, 0.0, 0.0, 1.0);
+            return texture(uTex1D[tex], coord1);
+            //return vec4(1.0, 0.0, 0.0, 1.0);
         case 1: // 2D
             if (uDepthComparison[tex] >= 0) {
                 // depth comparison
                 vec3 coord = vTexCoord[tex].stp / vTexCoord[tex].q;
                 float d = texture(uTex2D[tex], coord.st).r;
 
-                //if (compare(d, coord.p, uDepthComparison[tex])) {
-                //    return vec4(1.0);
-                //} else {
-                //    return vec4(0.0);
-                //}
-                return vec4(0.0, 0.5, 0.5, 1.0);
+                if (compare(d, coord.p, uDepthComparison[tex])) {
+                    return vec4(1.0);
+                } else {
+                    return vec4(0.0);
+                }
+                //return vec4(0.0, 0.5, 0.5, 1.0);
             } else {
                 // regular texture
                 vec2 coord = vTexCoord[tex].st / vTexCoord[tex].q;
-                //return texture(uTex2D[tex], coord);
-                return vec4(0.0, 1.0, 0.0, 1.0);
+                return texture(uTex2D[tex], coord);
+                //return vec4(0.0, 1.0, 0.0, 1.0);
             }
         case 2: // 3D
             vec3 coord3 = vTexCoord[tex].stp / vTexCoord[tex].q;
-            //return texture(uTex3D[tex], coord3);
-            return vec4(0.0, 0.0, 1.0, 1.0);
+            return texture(uTex3D[tex], coord3);
+            //return vec4(0.0, 0.0, 1.0, 1.0);
         case 3: // CUBE
             vec3 coord4 = vTexCoord[tex].stp; // no divide needed for cube maps
-            //return texture(uTexCube[tex], coord4);
-            return vec4(1.0, 1.0, 0.0, 1.0);
+            return texture(uTexCube[tex], coord4);
+            //return vec4(1.0, 1.0, 0.0, 1.0);
         default: // disabled
             return vec4(1.0, 0.0, 1.0, 1.0);
     }