diff options
Diffstat (limited to 'src/test/com/jogamp/opengl')
16 files changed, 218 insertions, 462 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 de5fe8eb2..55a043a14 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java @@ -48,7 +48,7 @@ import com.jogamp.graph.geom.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.graph.demos.GPURendererListenerBase01; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.glsl.ShaderState; @@ -247,9 +247,9 @@ public class TestRegionRendererNEWT01 extends UITestCase { private class RegionGLListener implements GLEventListener { String winTitle; String name; - GPURegionRendererListenerBase01 impl; + GPURendererListenerBase01 impl; - public RegionGLListener(GPURegionRendererListenerBase01 impl, String title, String name) { + public RegionGLListener(GPURendererListenerBase01 impl, String title, String name) { this.impl = impl; this.winTitle = title; this.name = name; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java index 905483e7f..d7696f36b 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java @@ -167,6 +167,10 @@ public class TestTextRendererNEWT00 extends UITestCase { } @Test + public void test00SceneNoAA() throws InterruptedException { + testImpl(0, 0, 0); + } + @Test public void test01SceneMSAA01() throws InterruptedException { if( SceneMSAASamples > 0 ) { testImpl(SceneMSAASamples, 0, 0); @@ -373,9 +377,11 @@ public class TestTextRendererNEWT00 extends UITestCase { lfps, tfps, gl.getSwapInterval(), (t1-t0)/1000.0, fontSizeAnim, drawable.getChosenGLCapabilities().getNumSamples(), modeS, vbaaSampleCount[0]); - if( false ) { - // renderString(drawable, font, pixelSize, getFontInfo(), 0, 0, 0, 0, -1000f, true); - renderString(drawable, font, pixelSize, textX2, 0, 0, 0, 0, -1000f, true); + if( true ) { + renderString(drawable, font, pixelSize, "I - / H P 7 0", 0, 0, 0, 0, -1000f, true); + // renderString(drawable, font, pixelSize, "I/- 0", 0, 0, 0, 0, -1000f, true); + // renderString(drawable, font, pixelSize, "012345678901234567890123456789", 0, 0, 0, -1000, true); + // renderString(drawable, font, pixelSize, textX2, 0, 0, 0, 0, -1000f, true); // renderString(drawable, font, pixelSize, text1, 0, 0, 0, -1000f, regionFPS); // no-cache } else { renderString(drawable, font, pixelSize, getFontInfo(), 0, 0, 0, 0, -1000, true); 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 feab048ea..f14da399e 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 @@ -46,11 +46,11 @@ import com.jogamp.opengl.util.PMVMatrix; * are on the curve. Demos the Res. Independent Nurbs based Curve rendering * */ -public class GPURegionGLListener01 extends GPURegionRendererListenerBase01 { +public class GPURegionGLListener01 extends GPURendererListenerBase01 { OutlineShape outlineShape = null; public GPURegionGLListener01 (RenderState rs, int renderModes, int sampleCount, boolean debug, boolean trace) { - super(rs, renderModes, debug, trace); + super(RegionRenderer.create(rs, renderModes, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); setMatrix(-20, 00, -50, 0f, sampleCount); } 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 8fbc73522..23ccef640 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 @@ -46,11 +46,11 @@ import com.jogamp.opengl.util.PMVMatrix; * into one region * */ -public class GPURegionGLListener02 extends GPURegionRendererListenerBase01 { +public class GPURegionGLListener02 extends GPURendererListenerBase01 { List<OutlineShape> outlineShapes = new ArrayList<OutlineShape>(); public GPURegionGLListener02 (RenderState rs, int renderModes, int sampleCount, boolean debug, boolean trace) { - super(rs, renderModes, debug, trace); + super(RegionRenderer.create(rs, renderModes, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); setMatrix(-20, 00, -50, 0f, sampleCount); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java index c6c4b62ce..7bcbe0484 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java @@ -39,6 +39,7 @@ import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.event.WindowAdapter; import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.glsl.ShaderState; @@ -49,25 +50,70 @@ import com.jogamp.opengl.util.glsl.ShaderState; * are on the curve. Demos the Res. Independent Nurbs based Curve rendering * */ -public class GPURegionNewtDemo01 { +public class GPURegionNewtDemo { static final boolean DEBUG = false; static final boolean TRACE = false; + static int SceneMSAASamples = 0; + static int GraphVBAASamples = 4; + static int GraphMSAASamples = 0; + static boolean GraphUseWeight = true; + public static void main(String[] args) { + if( 0 != args.length ) { + SceneMSAASamples = 0; + GraphMSAASamples = 0; + GraphVBAASamples = 0; + GraphUseWeight = false; + + for(int i=0; i<args.length; i++) { + if(args[i].equals("-smsaa")) { + i++; + SceneMSAASamples = MiscUtils.atoi(args[i], SceneMSAASamples); + } else if(args[i].equals("-gmsaa")) { + i++; + GraphMSAASamples = MiscUtils.atoi(args[i], GraphMSAASamples); + GraphVBAASamples = 0; + } else if(args[i].equals("-gvbaa")) { + i++; + GraphMSAASamples = 0; + GraphVBAASamples = MiscUtils.atoi(args[i], GraphVBAASamples); + } else if(args[i].equals("-gweight")) { + GraphUseWeight = true; + } + } + } + System.err.println("Scene MSAA Samples "+SceneMSAASamples); + System.err.println("Graph MSAA Samples"+GraphMSAASamples); + System.err.println("Graph VBAA Samples "+GraphVBAASamples); + System.err.println("Graph Weight Mode "+GraphUseWeight); + GLProfile glp = GLProfile.getGL2ES2(); GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); - caps.setSampleBuffers(true); - caps.setNumSamples(4); // 2 samples is not enough .. + if( SceneMSAASamples > 0 ) { + caps.setSampleBuffers(true); + caps.setNumSamples(SceneMSAASamples); + } System.out.println("Requested: " + caps); + int rmode = GraphUseWeight ? Region.VARIABLE_CURVE_WEIGHT_BIT : 0; + int sampleCount = 0; + if( GraphVBAASamples > 0 ) { + rmode |= Region.VBAA_RENDERING_BIT; + sampleCount += GraphVBAASamples; + } else if( GraphMSAASamples > 0 ) { + rmode |= Region.MSAA_RENDERING_BIT; + sampleCount += GraphMSAASamples; + } + final GLWindow window = GLWindow.create(caps); window.setPosition(10, 10); window.setSize(800, 400); - window.setTitle("GPU Curve Region Newt Demo 01 - vbaa0 msaa1"); + window.setTitle("GPU Curve Region Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples); RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory()); - GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (rs, Region.VARIABLE_CURVE_WEIGHT_BIT, 0, DEBUG, TRACE); + GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (rs, rmode, sampleCount, DEBUG, TRACE); regionGLListener.attachInputListenerTo(window); window.addGLEventListener(regionGLListener); window.setVisible(true); 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 deleted file mode 100644 index e7bd59aeb..000000000 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright 2010 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ - -package com.jogamp.opengl.test.junit.graph.demos; - -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.geom.SVertex; -import com.jogamp.newt.event.KeyAdapter; -import com.jogamp.newt.event.KeyEvent; -import com.jogamp.newt.event.WindowAdapter; -import com.jogamp.newt.event.WindowEvent; -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 - * - */ -public class GPURegionNewtDemo02 { - static final boolean DEBUG = false; - static final boolean TRACE = false; - - public static void main(String[] args) { - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); - caps.setAlphaBits(4); - System.out.println("Requested: " + caps); - - final GLWindow window = GLWindow.create(caps); - window.setPosition(10, 10); - window.setSize(800, 400); - window.setTitle("GPU Curve Region Newt Demo 02 - vbaa1 msaa0"); - - RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory()); - GPURegionGLListener02 regionGLListener = new GPURegionGLListener02 (rs, Region.VBAA_RENDERING_BIT|Region.VARIABLE_CURVE_WEIGHT_BIT, 4, DEBUG, TRACE); - regionGLListener.attachInputListenerTo(window); - window.addGLEventListener(regionGLListener); - window.setVisible(true); - - //FPSAnimator animator = new FPSAnimator(60); - final Animator animator = new Animator(); - animator.setUpdateFPSFrames(60, System.err); - animator.add(window); - - window.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent arg0) { - if(arg0.getKeyCode() == KeyEvent.VK_F4) { - window.destroy(); - } - } - }); - window.addWindowListener(new WindowAdapter() { - public void windowDestroyed(WindowEvent e) { - animator.stop(); - } - }); - - animator.start(); - } -} 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 deleted file mode 100644 index 9ececa082..000000000 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionRendererListenerBase01.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright 2010 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ -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.curve.opengl.RenderState; - -/** - * - * Action Keys: - * - 1/2: zoom in/out - * - 3/4: font +/- - * - 6/7: 2nd pass texture size - * - 0/9: rotate - * - s: toogle draw 'font set' - * - f: toggle draw fps - * - v: toggle v-sync - * - space: toggle font (ubuntu/java) - */ -public abstract class GPURegionRendererListenerBase01 extends GPURendererListenerBase01 { - OutlineShape outlineShape = null; - - public GPURegionRendererListenerBase01(RenderState rs, int renderModes, boolean debug, boolean trace) { - super(RegionRenderer.create(rs, renderModes, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); - } -} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo03.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java index 9174d69af..45d7dd343 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo03.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java @@ -38,10 +38,11 @@ import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.event.WindowAdapter; import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.glsl.ShaderState; -public class GPUTextNewtDemo03 { +public class GPUTextNewtDemo { /** * FIXME: * @@ -55,21 +56,62 @@ public class GPUTextNewtDemo03 { static final boolean DEBUG = false; static final boolean TRACE = false; + static int SceneMSAASamples = 0; + static int GraphVBAASamples = 4; + static int GraphMSAASamples = 0; + public static void main(String[] args) { + if( 0 != args.length ) { + SceneMSAASamples = 0; + GraphMSAASamples = 0; + GraphVBAASamples = 0; + + for(int i=0; i<args.length; i++) { + if(args[i].equals("-smsaa")) { + i++; + SceneMSAASamples = MiscUtils.atoi(args[i], SceneMSAASamples); + } else if(args[i].equals("-gmsaa")) { + i++; + GraphMSAASamples = MiscUtils.atoi(args[i], GraphMSAASamples); + GraphVBAASamples = 0; + } else if(args[i].equals("-gvbaa")) { + i++; + GraphMSAASamples = 0; + GraphVBAASamples = MiscUtils.atoi(args[i], GraphVBAASamples); + } + } + } + System.err.println("Scene MSAA Samples "+SceneMSAASamples); + System.err.println("Graph MSAA Samples "+GraphMSAASamples); + System.err.println("Graph VBAA Samples "+GraphVBAASamples); + GLProfile glp = GLProfile.getGL2ES2(); GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); - System.out.println("Requested: "+caps); + if( SceneMSAASamples > 0 ) { + caps.setSampleBuffers(true); + caps.setNumSamples(SceneMSAASamples); + } + System.out.println("Requested: " + caps); - final GLWindow window = GLWindow.create(caps); + int rmode = Region.VARIABLE_CURVE_WEIGHT_BIT; + int sampleCount = 0; + if( GraphVBAASamples > 0 ) { + rmode |= Region.VBAA_RENDERING_BIT; + sampleCount += GraphVBAASamples; + } else if( GraphMSAASamples > 0 ) { + rmode |= Region.MSAA_RENDERING_BIT; + sampleCount += GraphMSAASamples; + } + final GLWindow window = GLWindow.create(caps); window.setPosition(10, 10); window.setSize(800, 400); - window.setTitle("GPU Text Newt Demo 03 - gvbaa0 gmsaa4"); + window.setTitle("GPU Text Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples); RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory()); - GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, Region.MSAA_RENDERING_BIT, 4, true, DEBUG, TRACE); + GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, rmode, sampleCount, true, DEBUG, TRACE); // ((TextRenderer)textGLListener.getRenderer()).setCacheLimit(32); window.addGLEventListener(textGLListener); window.setVisible(true); 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 deleted file mode 100644 index de06310d7..000000000 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright 2010 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ -package com.jogamp.opengl.test.junit.graph.demos; - - -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; - -import com.jogamp.graph.curve.opengl.RenderState; -import com.jogamp.graph.geom.SVertex; -import com.jogamp.newt.event.KeyAdapter; -import com.jogamp.newt.event.KeyEvent; -import com.jogamp.newt.event.WindowAdapter; -import com.jogamp.newt.event.WindowEvent; -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; - static final boolean TRACE = false; - - public static void main(String[] args) { - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); - caps.setAlphaBits(4); - caps.setSampleBuffers(true); - caps.setNumSamples(4); // 2 samples is not enough .. - System.out.println("Requested: "+caps); - - final GLWindow window = GLWindow.create(caps); - window.setPosition(10, 10); - window.setSize(800, 400); - window.setTitle("GPU Text Newt Demo 01 - smsaa1"); - - final RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory()); - GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, 0, 0, true, DEBUG, TRACE); - window.addGLEventListener(textGLListener); - - final Animator animator = new Animator(); - animator.setUpdateFPSFrames(60, System.err); - animator.add(window); - - window.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent arg0) { - if(arg0.getKeyCode() == KeyEvent.VK_F4) { - window.destroy(); - } - } - }); - window.addWindowListener(new WindowAdapter() { - public void windowDestroyed(WindowEvent e) { - animator.stop(); - } - }); - - window.setVisible(true); - // FPSAnimator animator = new FPSAnimator(10); - animator.start(); - } -} 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 deleted file mode 100644 index 3dc03788b..000000000 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Copyright 2010 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ -package com.jogamp.opengl.test.junit.graph.demos; - -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.geom.SVertex; -import com.jogamp.newt.event.KeyAdapter; -import com.jogamp.newt.event.KeyEvent; -import com.jogamp.newt.event.WindowAdapter; -import com.jogamp.newt.event.WindowEvent; -import com.jogamp.newt.opengl.GLWindow; -import com.jogamp.opengl.util.Animator; -import com.jogamp.opengl.util.glsl.ShaderState; - -public class GPUTextNewtDemo02 { - /** - * FIXME: - * - * If DEBUG is enabled: - * - * Caused by: javax.media.opengl.GLException: Thread[main-Display-X11_:0.0-1-EDT-1,5,main] glGetError() returned the following error codes after a call to glFramebufferRenderbuffer(<int> 0x8D40, <int> 0x1902, <int> 0x8D41, <int> 0x1): GL_INVALID_ENUM ( 1280 0x500), - * at javax.media.opengl.DebugGL4bc.checkGLGetError(DebugGL4bc.java:33961) - * at javax.media.opengl.DebugGL4bc.glFramebufferRenderbuffer(DebugGL4bc.java:33077) - * at jogamp.graph.curve.opengl.VBORegion2PGL3.initFBOTexture(VBORegion2PGL3.java:295) - */ - static final boolean DEBUG = false; - static final boolean TRACE = false; - - public static void main(String[] args) { - boolean alpha = true; - boolean blending = true; - for(int i=0; i<args.length; i++) { - if(args[i].equals("-noblend")) { - blending = false; - } else if(args[i].equals("-noalpha")) { - alpha = false; - } - } - - final GLProfile glp = GLProfile.getGL2ES2(); - - GLCapabilities caps = new GLCapabilities(glp); - caps.setAlphaBits( alpha ? 4 : 0 ); - System.out.println("Requested: "+caps); - - final GLWindow window = GLWindow.create(caps); - - window.setPosition(10, 10); - window.setSize(800, 400); - window.setTitle("GPU Text Newt Demo 02 - gvbaa4 gmsaa0"); - - RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory()); - GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, Region.VBAA_RENDERING_BIT, 4, blending, DEBUG, TRACE); - // ((TextRenderer)textGLListener.getRenderer()).setCacheLimit(32); - window.addGLEventListener(textGLListener); - window.setVisible(true); - // FPSAnimator animator = new FPSAnimator(60); - final Animator animator = new Animator(); - animator.setUpdateFPSFrames(60, System.err); - animator.add(window); - - window.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent arg0) { - if(arg0.getKeyCode() == KeyEvent.VK_F4) { - window.destroy(); - } - } - }); - window.addWindowListener(new WindowAdapter() { - public void windowDestroyed(WindowEvent e) { - animator.stop(); - } - }); - - animator.start(); - } -} 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 a74fd407a..0bd4d45a4 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 @@ -258,7 +258,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB pmv.glLoadIdentity(); pmv.glTranslatef(nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy), nearPlaneZ0); renderer.updateMatrix(gl); - System.err.printf("FontN: [%f %f] -> [%f %f]%n", dx, dy, nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy)); + // System.err.printf("FontN: [%f %f] -> [%f %f]%n", dx, dy, nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy)); textRegionUtil.drawString3D(gl, font, nearPlaneS * pixelSizeFName, fontName, getSampleCount()); dx = 10f; @@ -267,7 +267,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB if(null != headtext) { pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmv.glLoadIdentity(); - System.err.printf("Head: [%f %f] -> [%f %f]%n", dx, dy, nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy)); + // System.err.printf("Head: [%f %f] -> [%f %f]%n", dx, dy, nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy)); pmv.glTranslatef(nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy), nearPlaneZ0); // pmv.glTranslatef(x0, y1, z0); renderer.updateMatrix(gl); @@ -279,7 +279,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmv.glLoadIdentity(); pmv.glTranslatef(nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy), nearPlaneZ0); - System.err.printf("Bottom: [%f %f] -> [%f %f]%n", dx, dy, nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy)); + // System.err.printf("Bottom: [%f %f] -> [%f %f]%n", dx, dy, nearPlaneX0+(dx*nearPlaneSx), nearPlaneY0+(dy*nearPlaneSy)); pmv.glTranslatef(getXTran(), getYTran(), getZTran()); pmv.glRotatef(getAngle(), 0, 1, 0); renderer.updateMatrix(gl); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java index 00338e41a..f22a5c56c 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java @@ -490,6 +490,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { } renderer = RegionRenderer.create(rs, renderModes, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); + // renderer = RegionRenderer.create(rs, renderModes, null, null); gl.setSwapInterval(1); gl.glEnable(GL2ES2.GL_DEPTH_TEST); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java new file mode 100644 index 000000000..c59d85824 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java @@ -0,0 +1,90 @@ +package com.jogamp.opengl.test.junit.graph.demos; + +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.geom.SVertex; +import com.jogamp.newt.event.WindowAdapter; +import com.jogamp.newt.event.WindowEvent; +import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.opengl.test.junit.util.MiscUtils; +import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.glsl.ShaderState; + +public class GPUUISceneNewtDemo { + static final boolean DEBUG = false; + static final boolean TRACE = false; + + static int SceneMSAASamples = 0; + static boolean GraphVBAAMode = true; + static boolean GraphMSAAMode = false; + + public static void main(String[] args) { + if( 0 != args.length ) { + SceneMSAASamples = 0; + GraphMSAAMode = false; + GraphVBAAMode = false; + + for(int i=0; i<args.length; i++) { + if(args[i].equals("-smsaa")) { + i++; + SceneMSAASamples = MiscUtils.atoi(args[i], SceneMSAASamples); + } else if(args[i].equals("-gmsaa")) { + GraphMSAAMode = true; + GraphVBAAMode = false; + } else if(args[i].equals("-gvbaa")) { + i++; + GraphMSAAMode = false; + GraphVBAAMode = true; + } + } + } + System.err.println("Scene MSAA Samples "+SceneMSAASamples); + System.err.println("Graph MSAA Mode "+GraphMSAAMode); + System.err.println("Graph VBAA Mode "+GraphVBAAMode); + + GLProfile glp = GLProfile.getGL2ES2(); + GLCapabilities caps = new GLCapabilities(glp); + caps.setAlphaBits(4); + if( SceneMSAASamples > 0 ) { + caps.setSampleBuffers(true); + caps.setNumSamples(SceneMSAASamples); + } + System.out.println("Requested: " + caps); + + final int rmode; + if( GraphVBAAMode ) { + rmode = Region.VBAA_RENDERING_BIT; + } else if( GraphMSAAMode ) { + rmode = Region.MSAA_RENDERING_BIT; + } else { + rmode = 0; + } + + final GLWindow window = GLWindow.create(caps); + window.setPosition(10, 10); + window.setSize(800, 400); + window.setTitle("GraphUI Newt Demo: graph["+Region.getRenderModeString(rmode)+"], msaa "+SceneMSAASamples); + + final RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory()); + GPUUISceneGLListener0A sceneGLListener = new GPUUISceneGLListener0A(rs, rmode, DEBUG, TRACE); + + window.addGLEventListener(sceneGLListener); + sceneGLListener.attachInputListenerTo(window); + + final Animator animator = new Animator(); + animator.setUpdateFPSFrames(60, null); // System.err); + animator.add(window); + + window.addWindowListener(new WindowAdapter() { + public void windowDestroyed(WindowEvent e) { + animator.stop(); + } + }); + + window.setVisible(true); + animator.start(); + } +} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo01.java deleted file mode 100644 index 127d30aae..000000000 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo01.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.jogamp.opengl.test.junit.graph.demos; - -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; - -import com.jogamp.graph.curve.opengl.RenderState; -import com.jogamp.graph.geom.SVertex; -import com.jogamp.newt.event.WindowAdapter; -import com.jogamp.newt.event.WindowEvent; -import com.jogamp.newt.opengl.GLWindow; -import com.jogamp.opengl.util.Animator; -import com.jogamp.opengl.util.glsl.ShaderState; - -public class GPUUISceneNewtDemo01 { - static final boolean DEBUG = false; - static final boolean TRACE = false; - - public static void main(String[] args) { - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); - caps.setAlphaBits(4); - caps.setSampleBuffers(true); - caps.setNumSamples(4); - - final GLWindow window = GLWindow.create(caps); - window.setPosition(10, 10); - window.setSize(800, 400); - window.setTitle("GraphUI Newt Demo"); - - final RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory()); - GPUUISceneGLListener0A textGLListener = new GPUUISceneGLListener0A(rs, 0, DEBUG, TRACE); - window.addGLEventListener(textGLListener); - textGLListener.attachInputListenerTo(window); - - final Animator animator = new Animator(); - animator.setUpdateFPSFrames(60, null);//System.err); - animator.add(window); - - window.addWindowListener(new WindowAdapter() { - public void windowDestroyed(WindowEvent e) { - animator.stop(); - } - }); - - window.setVisible(true); - animator.start(); - } -} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo02.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo02.java deleted file mode 100644 index b09a73160..000000000 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo02.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.jogamp.opengl.test.junit.graph.demos; - -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.geom.SVertex; -import com.jogamp.newt.event.WindowAdapter; -import com.jogamp.newt.event.WindowEvent; -import com.jogamp.newt.opengl.GLWindow; -import com.jogamp.opengl.util.Animator; -import com.jogamp.opengl.util.glsl.ShaderState; - -public class GPUUISceneNewtDemo02 { - static final boolean DEBUG = false; - static final boolean TRACE = false; - - public static void main(String[] args) { - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); - caps.setAlphaBits(4); - - final GLWindow window = GLWindow.create(caps); - window.setPosition(10, 10); - window.setSize(800, 400); - window.setTitle("GraphUI Newt Demo"); - - final RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory()); - GPUUISceneGLListener0A textGLListener = new GPUUISceneGLListener0A(rs, Region.VBAA_RENDERING_BIT, DEBUG, TRACE); - window.addGLEventListener(textGLListener); - textGLListener.attachInputListenerTo(window); - - final Animator animator = new Animator(); - animator.setUpdateFPSFrames(60, null); // System.err); - animator.add(window); - - window.addWindowListener(new WindowAdapter() { - public void windowDestroyed(WindowEvent e) { - animator.stop(); - } - }); - - window.setVisible(true); - animator.start(); - } -} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java index 19758539b..fb0604a44 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java @@ -786,11 +786,11 @@ public class TestQuaternion01NOUI { if( DEBUG )System.err.println("quat0 "+quat);
quat.rotateVector(vecHas, 0, UNIT_Z, 0);
if( DEBUG ) {
- System.err.println("xAxis "+Arrays.toString(xAxis)+", len "+VectorUtil.vec3Length(xAxis));
- System.err.println("yAxis "+Arrays.toString(yAxis)+", len "+VectorUtil.vec3Length(yAxis));
- System.err.println("zAxis "+Arrays.toString(zAxis)+", len "+VectorUtil.vec3Length(zAxis));
- System.err.println("exp0 "+Arrays.toString(direction)+", len "+VectorUtil.vec3Length(direction));
- System.err.println("has0 "+Arrays.toString(vecHas)+", len "+VectorUtil.vec3Length(vecHas));
+ System.err.println("xAxis "+Arrays.toString(xAxis)+", len "+VectorUtil.vec3Norm(xAxis));
+ System.err.println("yAxis "+Arrays.toString(yAxis)+", len "+VectorUtil.vec3Norm(yAxis));
+ System.err.println("zAxis "+Arrays.toString(zAxis)+", len "+VectorUtil.vec3Norm(zAxis));
+ System.err.println("exp0 "+Arrays.toString(direction)+", len "+VectorUtil.vec3Norm(direction));
+ System.err.println("has0 "+Arrays.toString(vecHas)+", len "+VectorUtil.vec3Norm(vecHas));
}
// Assert.assertEquals(0f, VectorUtil.distance(direction, quat.rotateVector(vecHas, 0, UNIT_Z, 0)), Quaternion.ALLOWED_DEVIANCE);
Assert.assertEquals(0f, VectorUtil.vec3Distance(direction, vecHas), Quaternion.ALLOWED_DEVIANCE);
@@ -801,11 +801,11 @@ public class TestQuaternion01NOUI { if( DEBUG )System.err.println("quat0 "+quat);
quat.rotateVector(vecHas, 0, UNIT_Z, 0);
if( DEBUG ) {
- System.err.println("xAxis "+Arrays.toString(xAxis)+", len "+VectorUtil.vec3Length(xAxis));
- System.err.println("yAxis "+Arrays.toString(yAxis)+", len "+VectorUtil.vec3Length(yAxis));
- System.err.println("zAxis "+Arrays.toString(zAxis)+", len "+VectorUtil.vec3Length(zAxis));
- System.err.println("exp0 "+Arrays.toString(direction)+", len "+VectorUtil.vec3Length(direction));
- System.err.println("has0 "+Arrays.toString(vecHas)+", len "+VectorUtil.vec3Length(vecHas));
+ System.err.println("xAxis "+Arrays.toString(xAxis)+", len "+VectorUtil.vec3Norm(xAxis));
+ System.err.println("yAxis "+Arrays.toString(yAxis)+", len "+VectorUtil.vec3Norm(yAxis));
+ System.err.println("zAxis "+Arrays.toString(zAxis)+", len "+VectorUtil.vec3Norm(zAxis));
+ System.err.println("exp0 "+Arrays.toString(direction)+", len "+VectorUtil.vec3Norm(direction));
+ System.err.println("has0 "+Arrays.toString(vecHas)+", len "+VectorUtil.vec3Norm(vecHas));
}
// Assert.assertEquals(0f, VectorUtil.distance(direction, quat.rotateVector(vecHas, 0, UNIT_Z, 0)), Quaternion.ALLOWED_DEVIANCE);
Assert.assertEquals(0f, VectorUtil.vec3Distance(direction, vecHas), Quaternion.ALLOWED_DEVIANCE);
|