diff options
Diffstat (limited to 'src/test/com/jogamp/opengl')
16 files changed, 97 insertions, 53 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java index 190ddc9c6..c948efc2d 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java @@ -15,11 +15,15 @@ import org.junit.BeforeClass; import org.junit.Test;
import com.jogamp.graph.curve.Region;
+import com.jogamp.graph.curve.opengl.RenderState;
+import com.jogamp.graph.curve.opengl.Renderer;
+import com.jogamp.graph.geom.opengl.SVertex;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.graph.demos.GPURegionGLListener01;
import com.jogamp.opengl.test.junit.graph.demos.GPURegionGLListener02;
import com.jogamp.opengl.test.junit.graph.demos.GPURegionRendererListenerBase01;
import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.glsl.ShaderState;
public class TestRegionRendererNEWT01 extends UITestCase {
@@ -63,8 +67,8 @@ public class TestRegionRendererNEWT01 extends UITestCase { caps.setAlphaBits(4);
GLWindow window = createWindow("shape-r2t1-msaa0", caps, 800,400);
-
- GPURegionGLListener02 demo02Listener = new GPURegionGLListener02 (Region.TWO_PASS, 1140, false, false);
+ RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory());
+ GPURegionGLListener02 demo02Listener = new GPURegionGLListener02 (rs, Region.TWO_PASS, 1140, false, false);
demo02Listener.attachInputListenerTo(window);
window.addGLEventListener(demo02Listener);
@@ -93,8 +97,9 @@ public class TestRegionRendererNEWT01 extends UITestCase { caps.setNumSamples(4);
GLWindow window = createWindow("shape-r2t0-msaa1", caps, 800, 400);
-
- GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (Region.SINGLE_PASS, 0, false, false);
+ RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory());
+
+ GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.SINGLE_PASS, 0, false, false);
demo01Listener.attachInputListenerTo(window);
window.addGLEventListener(demo01Listener);
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java index 1ef796265..f05b2ed35 100755 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java @@ -16,12 +16,15 @@ import org.junit.BeforeClass; import org.junit.Test;
import com.jogamp.graph.curve.Region;
+import com.jogamp.graph.curve.opengl.RenderState;
+import com.jogamp.graph.curve.opengl.Renderer;
import com.jogamp.graph.curve.opengl.TextRenderer;
import com.jogamp.graph.font.FontFactory;
import com.jogamp.graph.geom.opengl.SVertex;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.graph.demos.GPUTextRendererListenerBase01;
import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.glsl.ShaderState;
public class TestTextRendererNEWT01 extends UITestCase {
@@ -66,7 +69,8 @@ public class TestTextRendererNEWT01 extends UITestCase { caps.setAlphaBits(4);
GLWindow window = createWindow("text-r2t1-msaa0", caps, 800,400);
- TextGLListener textGLListener = new TextGLListener(Region.TWO_PASS, DEBUG, TRACE);
+ RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory());
+ TextGLListener textGLListener = new TextGLListener(rs, Region.TWO_PASS, DEBUG, TRACE);
textGLListener.attachInputListenerTo(window);
window.addGLEventListener(textGLListener);
@@ -102,7 +106,8 @@ public class TestTextRendererNEWT01 extends UITestCase { caps.setNumSamples(4);
GLWindow window = createWindow("text-r2t0-msaa1", caps, 800, 400);
- TextGLListener textGLListener = new TextGLListener(Region.SINGLE_PASS, DEBUG, TRACE);
+ RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory());
+ TextGLListener textGLListener = new TextGLListener(rs, Region.SINGLE_PASS, DEBUG, TRACE);
textGLListener.attachInputListenerTo(window);
window.addGLEventListener(textGLListener);
@@ -132,8 +137,8 @@ public class TestTextRendererNEWT01 extends UITestCase { private class TextGLListener extends GPUTextRendererListenerBase01 {
String winTitle;
- public TextGLListener(int type, boolean debug, boolean trace) {
- super(SVertex.factory(), type, debug, trace);
+ public TextGLListener(RenderState rs, int type, boolean debug, boolean trace) {
+ super(rs, type, debug, trace);
}
public void attachInputListenerTo(GLWindow window) {
@@ -155,7 +160,7 @@ public class TestTextRendererNEWT01 extends UITestCase { textRenderer.init(gl);
textRenderer.setAlpha(gl, 1.0f);
- textRenderer.setColor(gl, 0.0f, 0.0f, 0.0f);
+ textRenderer.setColorStatic(gl, 0.0f, 0.0f, 0.0f);
}
public void display(GLAutoDrawable drawable) {
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java index 7975f1897..1d086d93d 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java @@ -33,7 +33,7 @@ import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.opengl.SVertex; +import com.jogamp.graph.curve.opengl.RenderState; /** Demonstrate the rendering of multiple outlines into one region/OutlineShape * These Outlines are not necessary connected or contained. @@ -45,8 +45,8 @@ import com.jogamp.graph.geom.opengl.SVertex; public class GPURegionGLListener01 extends GPURegionRendererListenerBase01 { OutlineShape outlineShape = null; - public GPURegionGLListener01 (int numpass, int fbosize, boolean debug, boolean trace) { - super(SVertex.factory(), numpass, debug, trace); + public GPURegionGLListener01 (RenderState rs, int numpass, int fbosize, boolean debug, boolean trace) { + super(rs, numpass, debug, trace); setMatrix(-20, 00, 0f, -50, fbosize); } @@ -98,7 +98,7 @@ public class GPURegionGLListener01 extends GPURegionRendererListenerBase01 { gl.glEnable(GL2ES2.GL_DEPTH_TEST); regionRenderer.init(gl); regionRenderer.setAlpha(gl, 1.0f); - regionRenderer.setColor(gl, 0.0f, 0.0f, 0.0f); + regionRenderer.setColorStatic(gl, 0.0f, 0.0f, 0.0f); //gl.glSampleCoverage(0.95f, false); //gl.glEnable(GL2GL3.GL_SAMPLE_COVERAGE); // sample coverage doesn't really make a difference to lines //gl.glEnable(GL2GL3.GL_SAMPLE_ALPHA_TO_ONE); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java index 5a54b659d..1f57914a0 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java @@ -34,7 +34,7 @@ import javax.media.opengl.GLAutoDrawable; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.opengl.SVertex; +import com.jogamp.graph.curve.opengl.RenderState; /** Demonstrate the rendering of multiple OutlineShapes * into one region @@ -43,14 +43,14 @@ import com.jogamp.graph.geom.opengl.SVertex; public class GPURegionGLListener02 extends GPURegionRendererListenerBase01 { OutlineShape[] outlineShapes = new OutlineShape[2]; - public GPURegionGLListener02 (int numpass, int fbosize, boolean debug, boolean trace) { - super(SVertex.factory(), numpass, debug, trace); + public GPURegionGLListener02 (RenderState rs, int numpass, int fbosize, boolean debug, boolean trace) { + super(rs, numpass, debug, trace); setMatrix(-20, 00, 0f, -50, fbosize); } private void createTestOutline(){ float offset = 0; - outlineShapes[0] = new OutlineShape(SVertex.factory()); + outlineShapes[0] = new OutlineShape(getRenderer().getFactory()); outlineShapes[0].addVertex(0.0f,-10.0f,true); outlineShapes[0].addVertex(15.0f,-10.0f, true); outlineShapes[0].addVertex(10.0f,5.0f, false); @@ -67,7 +67,7 @@ public class GPURegionGLListener02 extends GPURegionRendererListenerBase01 { outlineShapes[0].closeLastOutline(); /** Same shape as above but without any off-curve vertices */ - outlineShapes[1] = new OutlineShape(SVertex.factory()); + outlineShapes[1] = new OutlineShape(getRenderer().getFactory()); offset = 30; outlineShapes[1].addVertex(offset+0.0f,-10.0f, true); outlineShapes[1].addVertex(offset+17.0f,-10.0f, true); @@ -96,7 +96,7 @@ public class GPURegionGLListener02 extends GPURegionRendererListenerBase01 { gl.glEnable(GL2ES2.GL_DEPTH_TEST); regionRenderer.init(gl); regionRenderer.setAlpha(gl, 1.0f); - regionRenderer.setColor(gl, 0.0f, 0.0f, 0.0f); + regionRenderer.setColorStatic(gl, 0.0f, 0.0f, 0.0f); MSAATool.dump(drawable); createTestOutline(); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java index e31da1170..e2ed5f0d0 100755 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java @@ -32,8 +32,12 @@ import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; import com.jogamp.graph.curve.Region; +import com.jogamp.graph.curve.opengl.RenderState; +import com.jogamp.graph.curve.opengl.Renderer; +import com.jogamp.graph.geom.opengl.SVertex; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.glsl.ShaderState; /** Demonstrate the rendering of multiple outlines into one region/OutlineShape * These Outlines are not necessary connected or contained. @@ -60,7 +64,8 @@ public class GPURegionNewtDemo01 { window.setSize(800, 400); window.setTitle("GPU Curve Region Newt Demo 01 - r2t0 msaa1"); - GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (Region.SINGLE_PASS, 0, DEBUG, TRACE); + RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory()); + GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (rs, Region.SINGLE_PASS, 0, DEBUG, TRACE); regionGLListener.attachInputListenerTo(window); window.addGLEventListener(regionGLListener); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java index a7ff0defa..678a40c29 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java @@ -32,8 +32,12 @@ import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; import com.jogamp.graph.curve.Region; +import com.jogamp.graph.curve.opengl.RenderState; +import com.jogamp.graph.curve.opengl.Renderer; +import com.jogamp.graph.geom.opengl.SVertex; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.glsl.ShaderState; /** Demonstrate the rendering of multiple OutlineShapes * into one region @@ -60,7 +64,8 @@ public class GPURegionNewtDemo02 { window.setSize(800, 400); window.setTitle("GPU Curve Region Newt Demo 02 - r2t1 msaa0"); - GPURegionGLListener02 regionGLListener = new GPURegionGLListener02 (Region.TWO_PASS, 1140, DEBUG, TRACE); + RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory()); + GPURegionGLListener02 regionGLListener = new GPURegionGLListener02 (rs, Region.TWO_PASS, 1140, DEBUG, TRACE); regionGLListener.attachInputListenerTo(window); window.addGLEventListener(regionGLListener); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionRendererListenerBase01.java index eab5fc8eb..f824b2e70 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionRendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionRendererListenerBase01.java @@ -29,7 +29,7 @@ package com.jogamp.opengl.test.junit.graph.demos; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; +import com.jogamp.graph.curve.opengl.RenderState; /** * @@ -46,7 +46,7 @@ import com.jogamp.graph.geom.Vertex; public abstract class GPURegionRendererListenerBase01 extends GPURendererListenerBase01 { OutlineShape outlineShape = null; - public GPURegionRendererListenerBase01(Vertex.Factory<? extends Vertex> factory, int mode, boolean debug, boolean trace) { - super(RegionRenderer.create(factory, mode), debug, trace); + public GPURegionRendererListenerBase01(RenderState rs, int mode, boolean debug, boolean trace) { + super(RegionRenderer.create(rs, mode), debug, trace); } }
\ No newline at end of file diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java index fa3e8515a..17e0a06d2 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java @@ -116,12 +116,13 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { renderer.reshapePerspective(gl, 45.0f, width, height, 0.1f, 7000.0f); dumpMatrix(); + System.err.println("Reshape: "+renderer.getRenderState()); } public void dispose(GLAutoDrawable drawable) { autoDrawable = null; GL2ES2 gl = drawable.getGL().getGL2ES2(); - screenshot.dispose(); + screenshot.dispose(gl); renderer.dispose(gl); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java index a62219a55..7153c1827 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java @@ -31,12 +31,12 @@ package com.jogamp.opengl.test.junit.graph.demos; import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; +import com.jogamp.graph.curve.opengl.RenderState; import com.jogamp.graph.curve.opengl.TextRenderer; -import com.jogamp.graph.geom.opengl.SVertex; public class GPUTextGLListener0A extends GPUTextRendererListenerBase01 { - public GPUTextGLListener0A(int numpass, int fbosize, boolean debug, boolean trace) { - super(SVertex.factory(), numpass, debug, trace); + public GPUTextGLListener0A(RenderState rs, int numpass, int fbosize, boolean debug, boolean trace) { + super(rs, numpass, debug, trace); setMatrix(-400, -30, 0f, -500, fbosize); } @@ -51,7 +51,7 @@ public class GPUTextGLListener0A extends GPUTextRendererListenerBase01 { gl.glEnable(GL2ES2.GL_DEPTH_TEST); textRenderer.init(gl); textRenderer.setAlpha(gl, 1.0f); - textRenderer.setColor(gl, 0.0f, 0.0f, 0.0f); + textRenderer.setColorStatic(gl, 0.0f, 0.0f, 0.0f); //gl.glSampleCoverage(0.95f, false); //gl.glEnable(GL2GL3.GL_SAMPLE_COVERAGE); // sample coverage doesn't really make a difference to lines //gl.glEnable(GL2GL3.GL_SAMPLE_ALPHA_TO_COVERAGE); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java index 086007da1..ff22a920e 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java @@ -32,8 +32,12 @@ import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; import com.jogamp.graph.curve.Region; +import com.jogamp.graph.curve.opengl.RenderState; +import com.jogamp.graph.curve.opengl.Renderer; +import com.jogamp.graph.geom.opengl.SVertex; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.glsl.ShaderState; public class GPUTextNewtDemo01 { static final boolean DEBUG = false; @@ -53,7 +57,8 @@ public class GPUTextNewtDemo01 { window.setSize(800, 400); window.setTitle("GPU Text Newt Demo 01 - r2t0 msaa1"); - GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(Region.SINGLE_PASS, 0, DEBUG, TRACE); + RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory()); + GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, Region.SINGLE_PASS, 0, DEBUG, TRACE); textGLListener.attachInputListenerTo(window); window.addGLEventListener(textGLListener); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java index f44e01c99..067d45b73 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java @@ -31,9 +31,13 @@ import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; import com.jogamp.graph.curve.Region; +import com.jogamp.graph.curve.opengl.RenderState; +import com.jogamp.graph.curve.opengl.Renderer; import com.jogamp.graph.curve.opengl.TextRenderer; +import com.jogamp.graph.geom.opengl.SVertex; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.glsl.ShaderState; public class GPUTextNewtDemo02 { /** @@ -63,7 +67,8 @@ public class GPUTextNewtDemo02 { window.setSize(800, 400); window.setTitle("GPU Text Newt Demo 02 - r2t1 msaa0"); - GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(Region.TWO_PASS, window.getWidth()*3, DEBUG, TRACE); + RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory()); + GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, Region.TWO_PASS, window.getWidth()*3, DEBUG, TRACE); // ((TextRenderer)textGLListener.getRenderer()).setCacheLimit(32); textGLListener.attachInputListenerTo(window); window.addGLEventListener(textGLListener); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java index a3ea93dff..7199226f9 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java @@ -33,6 +33,8 @@ import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAnimatorControl; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLException; + +import com.jogamp.graph.curve.opengl.RenderState; import com.jogamp.graph.curve.opengl.TextRenderer; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; @@ -89,8 +91,8 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB StringBuffer userString = new StringBuffer(); boolean userInput = false; - public GPUTextRendererListenerBase01(Vertex.Factory<? extends Vertex> factory, int mode, boolean debug, boolean trace) { - super(TextRenderer.create(factory, mode), debug, trace); + public GPUTextRendererListenerBase01(RenderState rs, int mode, boolean debug, boolean trace) { + super(TextRenderer.create(rs, mode), debug, trace); this.font = FontFactory.get(fontSet).getDefault(); dumpFontNames(); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java index cb9154c83..015819798 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java @@ -38,12 +38,12 @@ import com.jogamp.graph.geom.Vertex.Factory; */ public class RIButton extends UIControl{ private float width = 4.0f, height= 3.0f; - private float spacing = 0.3f; + private float spacing = 2.0f; private float[] scale = new float[]{1.0f,1.0f}; - private float corner = 0.5f; + private float corner = 1.0f; private float labelZOffset = -0.05f; - private float[] buttonColor = {0.0f, 0.0f, 0.0f}; + private float[] buttonColor = {0.6f, 0.6f, 0.6f}; private float[] labelColor = {1.0f, 1.0f, 1.0f}; public RIButton(Factory<? extends Vertex> factory, String label){ diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java index 1d4903e4f..9ad036d96 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java @@ -36,21 +36,24 @@ import jogamp.graph.curve.text.GlyphString; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RegionRenderer; +import com.jogamp.graph.curve.opengl.RenderState; import com.jogamp.graph.curve.opengl.TextRenderer; import com.jogamp.graph.geom.opengl.SVertex; import com.jogamp.opengl.test.junit.graph.demos.MSAATool; public class UIGLListener01 extends UIListenerBase01 { - public UIGLListener01 (boolean debug, boolean trace) { - super(RegionRenderer.create(SVertex.factory(), Region.SINGLE_PASS), - TextRenderer.create(SVertex.factory(), Region.SINGLE_PASS), debug, trace); + public UIGLListener01 (RenderState rs, boolean debug, boolean trace) { + super(RegionRenderer.create(rs, Region.SINGLE_PASS), + TextRenderer.create(rs, Region.SINGLE_PASS), debug, trace); setMatrix(-20, 00, 0f, -50); button = new RIButton(SVertex.factory(), "Click me!"); - button.setLabelColor(1.0f,1.0f,1.0f); - button.setButtonColor(0.6f,0.6f,0.6f); - button.setCorner(0.5f); - button.setSpacing(0.3f); + /** Button defaults ! + button.setLabelColor(1.0f,1.0f,1.0f); + button.setButtonColor(0.6f,0.6f,0.6f); + button.setCorner(1.0f); + button.setSpacing(2.0f); + */ System.err.println(button); } @@ -68,10 +71,12 @@ public class UIGLListener01 extends UIListenerBase01 { gl.glEnable(GL2ES2.GL_POLYGON_OFFSET_FILL); regionRenderer.init(gl); - regionRenderer.setAlpha(gl, 1.0f); + // default is 1.0f .. regionRenderer.setAlpha(gl, 1.0f); + // default is 0.5f .. regionRenderer.setSharpness(gl, 0.5f); + // FIXME: What if Sharpness diff for text/outline-only ?! - glyphString = textRenderer.createString(gl, button.getFont(), 10, button.getLabel(), 0.5f); - glyphString.generateRegion(gl.getContext(), 0.5f, regionRenderer.getShaderState(), regionRenderer.getRenderType()); + glyphString = textRenderer.createString(gl, button.getFont(), 10, button.getLabel()); + glyphString.generateRegion(gl, regionRenderer.getRenderState(), regionRenderer.getRenderType()); button.generate(glyphString.getBounds()); MSAATool.dump(drawable); @@ -90,14 +95,16 @@ public class UIGLListener01 extends UIListenerBase01 { regionRenderer.translate(null, getXTran(), getYTran(), getZoom()); regionRenderer.rotate(gl, getAngle(), 0, 1, 0); float[] bColor = button.getButtonColor(); - regionRenderer.setColor(gl, bColor[0], bColor[1], bColor[2]); + regionRenderer.setColorStatic(gl, bColor[0], bColor[1], bColor[2]); regionRenderer.renderOutlineShape(gl, button.getShape(glyphString.getBounds()), getPosition(), 0); float[] lColor = button.getLabelColor(); - regionRenderer.setColor(gl, lColor[0], lColor[1], lColor[2]); - glyphString.renderString3D(); + regionRenderer.setColorStatic(gl, lColor[0], lColor[1], lColor[2]); + glyphString.renderString3D(gl); } + public void dispose(GLAutoDrawable drawable) { + GL2ES2 gl = drawable.getGL().getGL2ES2(); super.dispose(drawable); - glyphString.destroy(); + glyphString.destroy(gl); } } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java index 67cb5cbdc..f854d8195 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java @@ -129,7 +129,7 @@ public abstract class UIListenerBase01 implements GLEventListener { public void dispose(GLAutoDrawable drawable) { autoDrawable = null; GL2ES2 gl = drawable.getGL().getGL2ES2(); - screenshot.dispose(); + screenshot.dispose(gl); rRenderer.dispose(gl); tRenderer.dispose(gl); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java index 167177ebc..e2aff5793 100755 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java @@ -31,8 +31,12 @@ package com.jogamp.opengl.test.junit.graph.demos.ui; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; +import com.jogamp.graph.curve.opengl.RenderState; +import com.jogamp.graph.curve.opengl.Renderer; +import com.jogamp.graph.geom.opengl.SVertex; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.glsl.ShaderState; /** Demonstrate the rendering of multiple outlines into one region/OutlineShape * These Outlines are not necessary connected or contained. @@ -58,8 +62,8 @@ public class UINewtDemo01 { window.setPosition(10, 10); window.setSize(800, 400); window.setTitle("GPU UI Newt Demo 01"); - - UIGLListener01 uiGLListener = new UIGLListener01 (DEBUG, TRACE); + RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory()); + UIGLListener01 uiGLListener = new UIGLListener01 (rs, DEBUG, TRACE); uiGLListener.attachInputListenerTo(window); window.addGLEventListener(uiGLListener); |