diff options
author | Sven Gothel <[email protected]> | 2011-05-08 05:37:45 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-05-08 05:37:45 +0200 |
commit | fbb4e5822c2da4458bfaeb728ba0eb2e45184e77 (patch) | |
tree | 870d581137aa2a96f86cff412be8af5bace26c70 /src/test/com | |
parent | b96b95e44e96dace30836c14704ca73ad3f22106 (diff) |
Graph/Tests: Adapt to latest commits ..
Diffstat (limited to 'src/test/com')
12 files changed, 74 insertions, 70 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 9dec119bc..c9c235c69 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java @@ -16,7 +16,6 @@ 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;
@@ -67,8 +66,8 @@ public class TestRegionRendererNEWT01 extends UITestCase { caps.setAlphaBits(4);
GLWindow window = createWindow("shape-vbaa1-msaa0", caps, 800,400);
- RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory());
- GPURegionGLListener02 demo02Listener = new GPURegionGLListener02 (rs, Region.TWO_PASS, true, 1140, false, false);
+ RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
+ GPURegionGLListener02 demo02Listener = new GPURegionGLListener02 (rs, Region.TWO_PASS_RENDERING_BIT, 1140, false, false);
demo02Listener.attachInputListenerTo(window);
window.addGLEventListener(demo02Listener);
@@ -97,9 +96,9 @@ public class TestRegionRendererNEWT01 extends UITestCase { caps.setNumSamples(4);
GLWindow window = createWindow("shape-vbaa0-msaa1", caps, 800, 400);
- RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory());
+ RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
- GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.SINGLE_PASS, true, 0, false, false);
+ GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, 0, 0, false, false);
demo01Listener.attachInputListenerTo(window);
window.addGLEventListener(demo01Listener);
@@ -127,13 +126,13 @@ public class TestRegionRendererNEWT01 extends UITestCase { caps.setNumSamples(4);
GLWindow window = createWindow("shape-vbaa0-msaa1", caps, 800, 400);
- RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory());
+ RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
- GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.SINGLE_PASS, false, 0, false, false);
+ GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.VARIABLE_CURVE_WEIGHT_BIT, 0, false, false);
demo01Listener.attachInputListenerTo(window);
window.addGLEventListener(demo01Listener);
- RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01");
+ RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion02");
window.addGLEventListener(listener);
listener.setTech(-20, 00, 0f, -300, 400);
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 78e89b792..a3bf215d9 100755 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java @@ -17,7 +17,6 @@ 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;
@@ -69,8 +68,8 @@ public class TestTextRendererNEWT01 extends UITestCase { caps.setAlphaBits(4);
GLWindow window = createWindow("text-vbaa1-msaa0", caps, 800,400);
- RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory());
- TextGLListener textGLListener = new TextGLListener(rs, Region.TWO_PASS, DEBUG, TRACE);
+ RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
+ TextGLListener textGLListener = new TextGLListener(rs, Region.TWO_PASS_RENDERING_BIT, DEBUG, TRACE);
textGLListener.attachInputListenerTo(window);
window.addGLEventListener(textGLListener);
@@ -106,8 +105,8 @@ public class TestTextRendererNEWT01 extends UITestCase { caps.setNumSamples(4);
GLWindow window = createWindow("text-vbaa0-msaa1", caps, 800, 400);
- RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory());
- TextGLListener textGLListener = new TextGLListener(rs, Region.SINGLE_PASS, DEBUG, TRACE);
+ RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
+ TextGLListener textGLListener = new TextGLListener(rs, 0, DEBUG, TRACE);
textGLListener.attachInputListenerTo(window);
window.addGLEventListener(textGLListener);
@@ -158,7 +157,6 @@ public class TestTextRendererNEWT01 extends UITestCase { final TextRenderer textRenderer = (TextRenderer) getRenderer();
- textRenderer.init(gl);
textRenderer.setAlpha(gl, 1.0f);
textRenderer.setColorStatic(gl, 0.0f, 0.0f, 0.0f);
}
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 215dae30a..e5e3c56e5 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 @@ -32,6 +32,8 @@ import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; import com.jogamp.graph.curve.OutlineShape; +import com.jogamp.graph.curve.Region; +import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.curve.opengl.RenderState; @@ -45,14 +47,14 @@ import com.jogamp.graph.curve.opengl.RenderState; public class GPURegionGLListener01 extends GPURegionRendererListenerBase01 { OutlineShape outlineShape = null; - public GPURegionGLListener01 (RenderState rs, int numpass, boolean uniform, int fbosize, boolean debug, boolean trace) { - super(rs, numpass, uniform, debug, trace); + public GPURegionGLListener01 (RenderState rs, int renderModes, int fbosize, boolean debug, boolean trace) { + super(rs, renderModes, debug, trace); setMatrix(-20, 00, 0f, -50, fbosize); } private void createTestOutline(){ float offset = 0; - outlineShape = new OutlineShape(getRenderer().getFactory()); + outlineShape = new OutlineShape(getRenderer().getRenderState().getVertexFactory()); outlineShape.addVertex(0.0f,-10.0f, true); outlineShape.addVertex(15.0f,-10.0f, true); outlineShape.addVertex(10.0f,5.0f, false); @@ -69,8 +71,8 @@ public class GPURegionGLListener01 extends GPURegionRendererListenerBase01 { outlineShape.closeLastOutline(); /** Same shape as above but without any off-curve vertices */ - outlineShape.addEmptyOutline(); offset = 30; + outlineShape.addEmptyOutline(); outlineShape.addVertex(offset+0.0f,-10.0f, true); outlineShape.addVertex(offset+17.0f,-10.0f, true); outlineShape.addVertex(offset+11.0f,5.0f, true); @@ -85,6 +87,8 @@ public class GPURegionGLListener01 extends GPURegionRendererListenerBase01 { outlineShape.addVertex(offset+10.0f,-5.0f, true); outlineShape.addVertex(offset+10.0f,0.0f, true); outlineShape.closeLastOutline(); + + region = GLRegion.create(outlineShape, getRenderModes()); } public void init(GLAutoDrawable drawable) { @@ -97,7 +101,6 @@ public class GPURegionGLListener01 extends GPURegionRendererListenerBase01 { gl.setSwapInterval(1); gl.glEnable(GL2ES2.GL_DEPTH_TEST); gl.glEnable(GL2ES2.GL_BLEND); - regionRenderer.init(gl); regionRenderer.setAlpha(gl, 1.0f); regionRenderer.setColorStatic(gl, 0.0f, 0.0f, 0.0f); MSAATool.dump(drawable); @@ -116,10 +119,9 @@ public class GPURegionGLListener01 extends GPURegionRendererListenerBase01 { regionRenderer.resetModelview(null); regionRenderer.translate(null, getXTran(), getYTran(), getZoom()); regionRenderer.rotate(gl, getAngle(), 0, 1, 0); - if(weightUpdated){ + if( weight != regionRenderer.getWeight()) { regionRenderer.setWeight(gl, weight); - weightUpdated = false; } - regionRenderer.renderOutlineShape(gl, outlineShape, getPosition(), getTexSize()); + regionRenderer.draw(gl, region, getPosition(), getTexSize()); } } 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 d7d335625..904e54e8e 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 @@ -33,6 +33,7 @@ import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; import com.jogamp.graph.curve.OutlineShape; +import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.curve.opengl.RenderState; @@ -43,14 +44,14 @@ import com.jogamp.graph.curve.opengl.RenderState; public class GPURegionGLListener02 extends GPURegionRendererListenerBase01 { OutlineShape[] outlineShapes = new OutlineShape[2]; - public GPURegionGLListener02 (RenderState rs, int numpass, boolean uniform, int fbosize, boolean debug, boolean trace) { - super(rs, numpass, uniform, debug, trace); + public GPURegionGLListener02 (RenderState rs, int renderModes, int fbosize, boolean debug, boolean trace) { + super(rs, renderModes, debug, trace); setMatrix(-20, 00, 0f, -50, fbosize); } private void createTestOutline(){ float offset = 0; - outlineShapes[0] = new OutlineShape(getRenderer().getFactory()); + outlineShapes[0] = new OutlineShape(getRenderer().getRenderState().getVertexFactory()); 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 +68,7 @@ public class GPURegionGLListener02 extends GPURegionRendererListenerBase01 { outlineShapes[0].closeLastOutline(); /** Same shape as above but without any off-curve vertices */ - outlineShapes[1] = new OutlineShape(getRenderer().getFactory()); + outlineShapes[1] = new OutlineShape(getRenderer().getRenderState().getVertexFactory()); offset = 30; outlineShapes[1].addVertex(offset+0.0f,-10.0f, true); outlineShapes[1].addVertex(offset+17.0f,-10.0f, true); @@ -83,6 +84,8 @@ public class GPURegionGLListener02 extends GPURegionRendererListenerBase01 { outlineShapes[1].addVertex(offset+10.0f,-5.0f, true); outlineShapes[1].addVertex(offset+10.0f,0.0f, true); outlineShapes[1].closeLastOutline(); + + region = GLRegion.create(outlineShapes, getRenderModes()); } public void init(GLAutoDrawable drawable) { @@ -95,7 +98,6 @@ public class GPURegionGLListener02 extends GPURegionRendererListenerBase01 { gl.setSwapInterval(1); gl.glEnable(GL2ES2.GL_DEPTH_TEST); gl.glEnable(GL2ES2.GL_BLEND); - regionRenderer.init(gl); regionRenderer.setAlpha(gl, 1.0f); regionRenderer.setColorStatic(gl, 0.0f, 0.0f, 0.0f); MSAATool.dump(drawable); @@ -114,8 +116,10 @@ public class GPURegionGLListener02 extends GPURegionRendererListenerBase01 { regionRenderer.resetModelview(null); regionRenderer.translate(null, getXTran(), getYTran(), getZoom()); regionRenderer.rotate(gl, getAngle(), 0, 1, 0); - - regionRenderer.renderOutlineShapes(gl, outlineShapes, getPosition(), getTexSize()); + if( weight != regionRenderer.getWeight()) { + regionRenderer.setWeight(gl, weight); + } + regionRenderer.draw(gl, region, getPosition(), getTexSize()); } } 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 d7f71301d..5e0c266e6 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 @@ -34,7 +34,6 @@ 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.event.KeyAdapter; import com.jogamp.newt.event.KeyEvent; @@ -69,9 +68,9 @@ public class GPURegionNewtDemo01 { window.setSize(800, 400); window.setTitle("GPU Curve Region Newt Demo 01 - vbaa0 msaa1"); - RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory()); - GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (rs, Region.SINGLE_PASS, false, 0, DEBUG, TRACE); - regionGLListener.attachInputListenerTo(window); + RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory()); + GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (rs, Region.VARIABLE_CURVE_WEIGHT_BIT, 0, DEBUG, TRACE); + regionGLListener.attachInputListenerTo(window); window.addGLEventListener(regionGLListener); window.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); 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 1440221a8..4cba9cbd5 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 @@ -34,7 +34,6 @@ 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.event.KeyAdapter; import com.jogamp.newt.event.KeyEvent; @@ -53,11 +52,6 @@ public class GPURegionNewtDemo02 { static final boolean TRACE = false; public static void main(String[] args) { - GPURegionNewtDemo02 test = new GPURegionNewtDemo02(); - test.testMe(); - } - - public void testMe() { GLProfile.initSingleton(true); GLProfile glp = GLProfile.getGL2ES2(); GLCapabilities caps = new GLCapabilities(glp); @@ -69,8 +63,8 @@ public class GPURegionNewtDemo02 { window.setSize(800, 400); window.setTitle("GPU Curve Region Newt Demo 02 - vbaa1 msaa0"); - RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory()); - GPURegionGLListener02 regionGLListener = new GPURegionGLListener02 (rs, Region.TWO_PASS, true, 1140, DEBUG, TRACE); + RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory()); + GPURegionGLListener02 regionGLListener = new GPURegionGLListener02 (rs, Region.TWO_PASS_RENDERING_BIT|Region.VARIABLE_CURVE_WEIGHT_BIT, 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 a0c25ab1a..8439d1fff 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 @@ -46,7 +46,7 @@ import com.jogamp.graph.curve.opengl.RenderState; public abstract class GPURegionRendererListenerBase01 extends GPURendererListenerBase01 { OutlineShape outlineShape = null; - public GPURegionRendererListenerBase01(RenderState rs, int mode, boolean uniform, boolean debug, boolean trace) { - super(RegionRenderer.create(rs, mode,uniform), debug, trace); + public GPURegionRendererListenerBase01(RenderState rs, int renderModes, boolean debug, boolean trace) { + super(RegionRenderer.create(rs, renderModes), renderModes, 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 3f060d15f..9587a672d 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 @@ -41,6 +41,9 @@ import javax.media.opengl.GLException; import javax.media.opengl.GLPipelineFactory; import javax.media.opengl.GLRunnable; + +import com.jogamp.graph.curve.Region; +import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.Renderer; import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.event.KeyListener; @@ -59,9 +62,12 @@ import com.jogamp.newt.opengl.GLWindow; public abstract class GPURendererListenerBase01 implements GLEventListener { private Screenshot screenshot; private Renderer renderer; + private int renderModes; private boolean debug; private boolean trace; + protected GLRegion region; + private KeyAction keyAction; private volatile GLAutoDrawable autoDrawable = null; @@ -74,18 +80,19 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { private float zoom = -70f; private int texSize = 400; - protected float weight = 1.0f; - protected boolean weightUpdated = false; + protected volatile float weight = 1.0f; boolean ignoreInput = false; - public GPURendererListenerBase01(Renderer renderer, boolean debug, boolean trace) { + public GPURendererListenerBase01(Renderer renderer, int renderModes, boolean debug, boolean trace) { this.renderer = renderer; + this.renderModes = renderModes; this.debug = debug; this.trace = trace; this.screenshot = new Screenshot(); } public final Renderer getRenderer() { return renderer; } + public final int getRenderModes() { return renderModes; } public final float getZoom() { return zoom; } public final float getXTran() { return xTran; } public final float getYTran() { return yTran; } @@ -113,6 +120,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { System.err.println("*** "+gl.getContext().getGLVersion()); System.err.println("*** GLDebugMessage "+gl.getContext().isGLDebugMessageEnabled()); gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); + getRenderer().init(gl); } public void reshape(GLAutoDrawable drawable, int xstart, int ystart, int width, int height) { @@ -128,6 +136,9 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { public void dispose(GLAutoDrawable drawable) { autoDrawable = null; GL2ES2 gl = drawable.getGL().getGL2ES2(); + if(null != region) { + region.destroy(gl, renderer.getRenderState()); + } screenshot.dispose(gl); renderer.destroy(gl); } @@ -147,11 +158,11 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { ang %= 360.0f; dumpMatrix(); } - public void editGlobalWeight(float delta){ - if((weight+delta) > 1.9f || (weight+delta) < 0.0f) + public void editGlobalWeight(float delta) { + if( !Renderer.isWeightValid(weight+delta) ) { return; + } weight += delta; - weightUpdated = true; System.err.println("Global Weight: "+ weight); } @@ -263,7 +274,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { autoDrawable.invoke(false, new GLRunnable() { public void run(GLAutoDrawable drawable) { try { - final String type = ( 1 == renderer.getRenderType() ) ? "r2t0-msaa1" : "r2t1-msaa0" ; + final String type = Region.usesTwoPassRendering(renderModes) ? "r2t0-msaa1" : "r2t1-msaa0" + ( Region.usesVariableCurveWeight(renderModes) ? "-vc" : "-uc" ) ; printScreen(drawable, "./", "demo-"+type, "snap"+screenshot_num, false); screenshot_num++; } catch (GLException e) { 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 a88b6b3ca..6d97505c4 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 @@ -50,7 +50,6 @@ public class GPUTextGLListener0A extends GPUTextRendererListenerBase01 { gl.setSwapInterval(1); gl.glEnable(GL2ES2.GL_DEPTH_TEST); gl.glEnable(GL2ES2.GL_BLEND); - textRenderer.init(gl); textRenderer.setAlpha(gl, 1.0f); textRenderer.setColorStatic(gl, 0.0f, 0.0f, 0.0f); MSAATool.dump(drawable); 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 6b1bbee35..b9a045498 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,9 +32,9 @@ import javax.media.opengl.FPSCounter; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; -import com.jogamp.graph.curve.Region; + +import com.jogamp.graph.curve.opengl.GLRegion; 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.event.KeyAdapter; import com.jogamp.newt.event.KeyEvent; @@ -62,8 +62,8 @@ public class GPUTextNewtDemo01 { window.setSize(800, 400); window.setTitle("GPU Text Newt Demo 01 - vbaa0 msaa1"); - final RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory()); - GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, Region.SINGLE_PASS, 0, DEBUG, TRACE); + final RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory()); + GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, 0, 0, DEBUG, TRACE); textGLListener.attachInputListenerTo(window); window.addGLEventListener(textGLListener); window.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err); 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 0f1b95165..320e79472 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 @@ -33,8 +33,6 @@ 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.event.KeyAdapter; import com.jogamp.newt.event.KeyEvent; @@ -72,8 +70,8 @@ public class GPUTextNewtDemo02 { window.setSize(800, 400); window.setTitle("GPU Text Newt Demo 02 - vbaa1 msaa0"); - RenderState rs = Renderer.createRenderState(new ShaderState(), SVertex.factory()); - GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, Region.TWO_PASS, window.getWidth()*3, DEBUG, TRACE); + RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory()); + GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, Region.TWO_PASS_RENDERING_BIT, 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 39ebba6e5..0fced4715 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 @@ -102,12 +102,12 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB StringBuffer userString = new StringBuffer(); boolean userInput = false; - public GPUTextRendererListenerBase01(RenderState rs, int mode, boolean debug, boolean trace) { - super(TextRenderer.create(rs, mode), debug, trace); + public GPUTextRendererListenerBase01(RenderState rs, int modes, boolean debug, boolean trace) { + super(TextRenderer.create(rs, modes), modes, debug, trace); this.font = FontFactory.get(fontSet).getDefault(); dumpFontNames(); - this.fontName = font.getName(Font.NAME_FAMILY) + " - " + font.getName(Font.NAME_SUBFAMILY); + this.fontName = font.toString(); this.fontNameBox = font.getStringBounds(fontName, fontSizeFixed*2); switchHeadBox(); } @@ -160,7 +160,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB final int fpsSp = fpsS.indexOf('.'); textRenderer.resetModelview(null); textRenderer.translate(gl, fontSizeFixed, fontSizeFixed, -6000); - textRenderer.renderString3D(gl, font, fpsS.substring(0, fpsSp+2)+" fps", getPosition(), fontSizeFixed*3, getTexSize()); + textRenderer.drawString3D(gl, font, fpsS.substring(0, fpsSp+2)+" fps", getPosition(), fontSizeFixed*3, getTexSize()); } int dx = width-(int)fontNameBox.getWidth()-2 ; @@ -168,7 +168,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB textRenderer.resetModelview(null); textRenderer.translate(gl, dx, dy, -6000); - textRenderer.renderString3D(gl, font, fontName, getPosition(), fontSizeFixed*2, getTexSize()); + textRenderer.drawString3D(gl, font, fontName, getPosition(), fontSizeFixed*2, getTexSize()); dx = 10; dy += -(int)fontNameBox.getHeight() - 10; @@ -176,7 +176,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB if(null != headtext) { textRenderer.resetModelview(null); textRenderer.translate(gl, dx, dy, -6000); - textRenderer.renderString3D(gl, font, headtext, getPosition(), fontSizeFixed*3, getTexSize()); + textRenderer.drawString3D(gl, font, headtext, getPosition(), fontSizeFixed*3, getTexSize()); } textRenderer.reshapePerspective(null, 45.0f, width, height, 0.1f, 7000.0f); @@ -186,9 +186,9 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB textRenderer.rotate(gl, getAngle(), 0, 1, 0); textRenderer.setColorStatic(gl, 1.0f, 0.0f, 0.0f); if(!userInput) { - textRenderer.renderString3D(gl, font, text2, getPosition(), fontSize, getTexSize()); + textRenderer.drawString3D(gl, font, text2, getPosition(), fontSize, getTexSize()); } else { - textRenderer.renderString3D(gl, font, userString.toString(), getPosition(), fontSize, getTexSize()); + textRenderer.drawString3D(gl, font, userString.toString(), getPosition(), fontSize, getTexSize()); } } @@ -200,8 +200,8 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB public void nextFontSet() { fontSet = ( fontSet == FontFactory.UBUNTU ) ? FontFactory.JAVA : FontFactory.UBUNTU ; - font = FontFactory.get(fontSet).getDefault(); - this.fontName = font.getName(Font.NAME_FAMILY) + " - " + font.getName(Font.NAME_SUBFAMILY); + font = FontFactory.get(fontSet).getDefault(); + this.fontName = font.getFullFamilyName(null).toString(); this.fontNameBox = font.getStringBounds(fontName, fontSizeFixed*3); dumpFontNames(); } @@ -243,7 +243,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB } public void printScreen(GLAutoDrawable drawable, String dir, String tech, boolean exportAlpha) throws GLException, IOException { - final String fn = font.getName(Font.NAME_FAMILY)+"-"+font.getName(Font.NAME_SUBFAMILY); + final String fn = font.getFullFamilyName(null).toString(); printScreen(drawable, dir, tech, fn.replace(' ', '_'), exportAlpha); } |