From 5940f88b19a375bd20432be01bde02cda065fbce Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 24 Feb 2012 02:40:10 +0100 Subject: Fix MultisampleDemo01 -> MultisampleDemoES1 (proper profile, remove immediate mode for ES1) ; Fix GLES1Impl.glOrtho() --- make/config/jogl/gl-es1.cfg | 2 +- make/scripts/targetcommand-1.sh | 10 +- make/scripts/tests.sh | 8 +- .../test/junit/jogl/caps/MultisampleDemo01.java | 138 ------------------ .../test/junit/jogl/caps/MultisampleDemoES1.java | 154 +++++++++++++++++++++ .../test/junit/jogl/caps/TestMultisampleAWT.java | 121 ---------------- .../junit/jogl/caps/TestMultisampleES1AWT.java | 123 ++++++++++++++++ .../junit/jogl/caps/TestMultisampleES1NEWT.java | 104 ++++++++++++++ .../test/junit/jogl/caps/TestMultisampleNEWT.java | 101 -------------- 9 files changed, 391 insertions(+), 370 deletions(-) delete mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleDemo01.java create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleDemoES1.java delete mode 100755 src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleAWT.java create mode 100755 src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1AWT.java create mode 100755 src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1NEWT.java delete mode 100755 src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleNEWT.java diff --git a/make/config/jogl/gl-es1.cfg b/make/config/jogl/gl-es1.cfg index 1488c18e6..2a7b64dd3 100644 --- a/make/config/jogl/gl-es1.cfg +++ b/make/config/jogl/gl-es1.cfg @@ -67,7 +67,7 @@ JavaPrologue glPixelStorei glStateTracker.setInt(pname, param); JavaPrologue glGetIntegerv if ( glStateTracker.getInt(pname, params, params_offset) ) { return; } CustomJavaCode GLES1Impl public void glOrtho(double left, double right, double bottom, double top, double near_val, double far_val) { -CustomJavaCode GLES1Impl glOrtho((float) left, (float) right, (float) bottom, (float) top, (float) near_val, (float) far_val); } +CustomJavaCode GLES1Impl glOrthof((float) left, (float) right, (float) bottom, (float) top, (float) near_val, (float) far_val); } CustomJavaCode GLES1Impl public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { CustomJavaCode GLES1Impl glFrustumf((float) left, (float) right, (float) bottom, (float) top, (float) zNear, (float) zFar); } diff --git a/make/scripts/targetcommand-1.sh b/make/scripts/targetcommand-1.sh index 1987441ba..38392f9b2 100755 --- a/make/scripts/targetcommand-1.sh +++ b/make/scripts/targetcommand-1.sh @@ -2,7 +2,7 @@ THISDIR=`pwd` -XTRA_FLAGS="-Dnewt.test.Screen.disableScreenMode" +#XTRA_FLAGS="-Dnewt.test.Screen.disableScreenMode -Djogl.debug.GLBufferSizeTracker" #XTRA_FLAGS="-Dnewt.debug.Screen" #XTRA_FLAGS="-Dnewt.debug.Window -Djogl.debug.EGL -Djogl.debug.GLContext -Djogl.debug.GLDrawable" #XTRA_FLAGS="-Djogl.debug.EGL" @@ -26,17 +26,17 @@ XTRA_FLAGS="-Dnewt.test.Screen.disableScreenMode" # Some Regressions (Panda, Omap4) # #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT2 +#TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT -#TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestMapBuffer01NEWT +#TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestMapBufferRead01NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestNVSwapGroupNEWT -#TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES1NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT2 -TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT +#TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.acore.TestShutdownSharedNEWT -#TSTCLASS=com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleNEWT +TSTCLASS=com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES1NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyNEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestGearsES1NEWT #TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestRedSquareES1NEWT diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index b844b49f7..cdeb2f982 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -187,7 +187,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen02BitmapNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $* -testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownSharedNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestInitConcurrentNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLDebug00NEWT $* @@ -284,8 +284,8 @@ testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT $* #testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer02NewtCanvasAWT $* #testawt com.jogamp.opengl.test.junit.newt.parenting.TestTranslucentParentingAWT $* #testawt com.jogamp.opengl.test.junit.newt.TestCloseNewtAWT -#testawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleAWT $* -#testawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleNEWT $* +#testawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES1AWT $* +testawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES1NEWT $* #testawt com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyAWT $* #testawt com.jogamp.opengl.test.junit.jogl.caps.TestTranslucencyNEWT $* #testawt com.jogamp.opengl.test.junit.jogl.glsl.TestShaderCompilationBug459AWT @@ -314,7 +314,7 @@ testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo02 $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMapBuffer01NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMapBufferRead01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT $* # diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleDemo01.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleDemo01.java deleted file mode 100644 index ab0171cb8..000000000 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleDemo01.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * Copyright (c) 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: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution 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. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package com.jogamp.opengl.test.junit.jogl.caps; - -import jogamp.opengl.x11.glx.GLX; -import jogamp.opengl.x11.glx.X11GLXGraphicsConfiguration; -import javax.media.nativewindow.AbstractGraphicsConfiguration; -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GL; -import javax.media.opengl.GL2; -import javax.media.opengl.GL2ES1; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLPipelineFactory; - -class MultisampleDemo01 implements GLEventListener { - - static boolean glDebug = false; - static boolean glTrace = false; - - boolean multisample; - - public MultisampleDemo01(boolean multisample) { - this.multisample = multisample; - } - - public void init(GLAutoDrawable drawable) { - AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration(); - System.err.println(); - System.err.println("Info: " + config); - System.err.println(); - if (NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(false))) { - X11GLXGraphicsConfiguration x11config = (X11GLXGraphicsConfiguration) config; - long display = drawable.getNativeSurface().getDisplayHandle(); - int[] foo = new int[1]; - GLX.glXGetFBConfigAttrib(display, x11config.getFBConfig(), GLX.GLX_SAMPLES, foo, 0); - System.out.println("GLX_SAMPLES " + foo[0]); - GLX.glXGetFBConfigAttrib(display, x11config.getFBConfig(), GLX.GLX_SAMPLE_BUFFERS, foo, 0); - System.out.println("GLX_SAMPLE_BUFFERS " + foo[0]); - } - GL _gl = drawable.getGL(); - if (glDebug) { - try { - // Debug .. - _gl = _gl.getContext().setGL(GLPipelineFactory.create("javax.media.opengl.Debug", GL2.class, _gl, null)); - if (glTrace) { - // Trace .. - _gl = _gl.getContext().setGL(GLPipelineFactory.create("javax.media.opengl.Trace", GL2.class, _gl, new Object[]{System.err})); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - GL2 gl = _gl.getGL2(); - if (multisample) { - gl.glEnable(GL.GL_MULTISAMPLE); - } - gl.glClearColor(0, 0, 0, 0); - // gl.glEnable(GL.GL_DEPTH_TEST); - // gl.glDepthFunc(GL.GL_LESS); - gl.glMatrixMode(GL2ES1.GL_MODELVIEW); - gl.glLoadIdentity(); - gl.glMatrixMode(GL2ES1.GL_PROJECTION); - gl.glLoadIdentity(); - gl.glOrtho(-1, 1, -1, 1, -1, 1); - if (multisample) { - gl.glDisable(GL.GL_MULTISAMPLE); - } - } - - public void dispose(GLAutoDrawable drawable) { - } - - public void display(GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); - if (multisample) { - gl.glEnable(GL.GL_MULTISAMPLE); - } - gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - int numSteps = 20; - double increment = Math.PI / numSteps; - double radius = 1; - gl.glBegin(GL.GL_LINES); - for (int i = numSteps - 1; i >= 0; i--) { - gl.glVertex3d(radius * Math.cos(i * increment), radius * Math.sin(i * increment), 0); - gl.glVertex3d(-1.0 * radius * Math.cos(i * increment), -1.0 * radius * Math.sin(i * increment), 0); - } - gl.glEnd(); - if (multisample) { - gl.glDisable(GL.GL_MULTISAMPLE); - } - } - - // Unused routines - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - } - - public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { - } -} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleDemoES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleDemoES1.java new file mode 100644 index 000000000..0aaf4b020 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleDemoES1.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 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: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution 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. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.jogamp.opengl.test.junit.jogl.caps; + +import jogamp.opengl.x11.glx.GLX; +import jogamp.opengl.x11.glx.X11GLXGraphicsConfiguration; +import javax.media.nativewindow.AbstractGraphicsConfiguration; +import javax.media.nativewindow.NativeWindowFactory; +import javax.media.opengl.GL; +import javax.media.opengl.GL2ES1; +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLEventListener; +import javax.media.opengl.GLPipelineFactory; + +import com.jogamp.opengl.util.ImmModeSink; + +class MultisampleDemoES1 implements GLEventListener { + + static boolean glDebug = false; + static boolean glTrace = false; + + boolean multisample; + ImmModeSink immModeSink; + + public MultisampleDemoES1(boolean multisample) { + this.multisample = multisample; + } + + public void init(GLAutoDrawable drawable) { + System.err.println(); + System.err.println("Requested: " + drawable.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities()); + System.err.println(); + System.err.println("Chosen : " + drawable.getChosenGLCapabilities()); + System.err.println(); + if (!drawable.getGL().isGLES() && NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(false))) { + AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration(); + X11GLXGraphicsConfiguration x11config = (X11GLXGraphicsConfiguration) config; + long display = drawable.getNativeSurface().getDisplayHandle(); + int[] foo = new int[1]; + GLX.glXGetFBConfigAttrib(display, x11config.getFBConfig(), GLX.GLX_SAMPLES, foo, 0); + System.out.println("GLX_SAMPLES " + foo[0]); + GLX.glXGetFBConfigAttrib(display, x11config.getFBConfig(), GLX.GLX_SAMPLE_BUFFERS, foo, 0); + System.out.println("GLX_SAMPLE_BUFFERS " + foo[0]); + } + GL _gl = drawable.getGL(); + if (glDebug) { + try { + // Debug .. + _gl = _gl.getContext().setGL(GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES1.class, _gl, null)); + if (glTrace) { + // Trace .. + _gl = _gl.getContext().setGL(GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES1.class, _gl, new Object[]{System.err})); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + GL2ES1 gl = _gl.getGL2ES1(); + if (multisample) { + gl.glEnable(GL.GL_MULTISAMPLE); + } + gl.glClearColor(0, 0, 0, 0); + // gl.glEnable(GL.GL_DEPTH_TEST); + // gl.glDepthFunc(GL.GL_LESS); + gl.glMatrixMode(GL2ES1.GL_MODELVIEW); + gl.glLoadIdentity(); + gl.glMatrixMode(GL2ES1.GL_PROJECTION); + gl.glLoadIdentity(); + gl.glOrtho(-1, 1, -1, 1, -1, 1); + if (multisample) { + gl.glDisable(GL.GL_MULTISAMPLE); + } + immModeSink = ImmModeSink.createFixed(gl, GL.GL_STATIC_DRAW, 40, + 3, GL.GL_FLOAT, // vertex + 0, GL.GL_FLOAT, // color + 0, GL.GL_FLOAT,// normal + 0, GL.GL_FLOAT); // texture + final int numSteps = 20; + final double increment = Math.PI / numSteps; + final double radius = 1; + immModeSink.glBegin(GL.GL_LINES); + for (int i = numSteps - 1; i >= 0; i--) { + immModeSink.glVertex3f((float) (radius * Math.cos(i * increment)), + (float) (radius * Math.sin(i * increment)), + 0f); + immModeSink.glVertex3f((float) (-1.0 * radius * Math.cos(i * increment)), + (float) (-1.0 * radius * Math.sin(i * increment)), + 0f); + } + immModeSink.glEnd(gl, false); + } + + public void dispose(GLAutoDrawable drawable) { + immModeSink.destroy(drawable.getGL()); + immModeSink = null; + } + + public void display(GLAutoDrawable drawable) { + GL2ES1 gl = drawable.getGL().getGL2ES1(); + if (multisample) { + gl.glEnable(GL.GL_MULTISAMPLE); + } + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); + immModeSink.draw(gl, true); + if (multisample) { + gl.glDisable(GL.GL_MULTISAMPLE); + } + } + + // Unused routines + public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + } + + public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { + } +} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleAWT.java deleted file mode 100755 index 786fd608b..000000000 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleAWT.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * Copyright (c) 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: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution 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. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package com.jogamp.opengl.test.junit.jogl.caps; - -import java.lang.reflect.InvocationTargetException; -import java.awt.BorderLayout; -import java.awt.Frame; - -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesChooser; -import javax.media.opengl.awt.GLCanvas; - -import com.jogamp.opengl.test.junit.util.MiscUtils; -import com.jogamp.opengl.test.junit.util.UITestCase; - -import org.junit.Test; - - -public class TestMultisampleAWT extends UITestCase { - static long durationPerTest = 250; // ms - private GLCanvas canvas; - - public static void main(String[] args) { - for(int i=0; i0) { - caps.setSampleBuffers(true); - caps.setNumSamples(samples); - // turns out we need to have alpha, - // otherwise no AA will be visible. - caps.setAlphaBits(1); - } - - canvas = new GLCanvas(caps, chooser, null, null); - canvas.addGLEventListener(new MultisampleDemo01(samples>0?true:false)); - - final Frame frame = new Frame("Multi Samples "+samples); - frame.setLayout(new BorderLayout()); - canvas.setSize(512, 512); - frame.add(canvas, BorderLayout.CENTER); - frame.pack(); - - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.setVisible(true); - frame.setLocation(0, 0); - canvas.requestFocus(); - canvas.display(); - }}); - - Thread.sleep(durationPerTest); - - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.setVisible(false); - frame.remove(canvas); - frame.dispose(); - }}); - - } -} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1AWT.java new file mode 100755 index 000000000..517d12578 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1AWT.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 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: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution 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. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.jogamp.opengl.test.junit.jogl.caps; + +import java.lang.reflect.InvocationTargetException; +import java.awt.BorderLayout; +import java.awt.Frame; + +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLCapabilitiesChooser; +import javax.media.opengl.GLProfile; +import javax.media.opengl.awt.GLCanvas; + +import com.jogamp.opengl.test.junit.util.MiscUtils; +import com.jogamp.opengl.test.junit.util.UITestCase; + +import org.junit.Test; + + +public class TestMultisampleES1AWT extends UITestCase { + static long durationPerTest = 250; // ms + private GLCanvas canvas; + + public static void main(String[] args) { + for(int i=0; i0) { + caps.setSampleBuffers(true); + caps.setNumSamples(samples); + // turns out we need to have alpha, + // otherwise no AA will be visible. + caps.setAlphaBits(1); + } + + canvas = new GLCanvas(caps, chooser, null, null); + canvas.addGLEventListener(new MultisampleDemoES1(samples>0?true:false)); + + final Frame frame = new Frame("Multi Samples "+samples); + frame.setLayout(new BorderLayout()); + canvas.setSize(512, 512); + frame.add(canvas, BorderLayout.CENTER); + frame.pack(); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.setVisible(true); + frame.setLocation(0, 0); + canvas.requestFocus(); + canvas.display(); + }}); + + Thread.sleep(durationPerTest); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.setVisible(false); + frame.remove(canvas); + frame.dispose(); + }}); + + } +} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1NEWT.java new file mode 100755 index 000000000..cdfeb2bad --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1NEWT.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 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: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution 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. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.jogamp.opengl.test.junit.jogl.caps; + +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLCapabilitiesChooser; +import javax.media.opengl.GLProfile; + +import org.junit.Test; + +import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.opengl.test.junit.util.MiscUtils; + +public class TestMultisampleES1NEWT { + static long durationPerTest = 500; // ms + private GLWindow window; + + public static void main(String[] args) { + for(int i=0; i0) { + caps.setSampleBuffers(true); + caps.setNumSamples(4); + } + // turns out we need to have alpha, + // otherwise no AA will be visible. + // This is done implicit now .. + // caps.setAlphaBits(1); + + window = GLWindow.create(caps); + window.setCapabilitiesChooser(chooser); + window.addGLEventListener(new MultisampleDemoES1(samples>0?true:false)); + window.setSize(512, 512); + window.setVisible(true); + window.setPosition(0, 0); + window.requestFocus(); + + Thread.sleep(durationPerTest); + + window.destroy(); + } + +} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleNEWT.java deleted file mode 100755 index 1e3274dbb..000000000 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleNEWT.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * Copyright (c) 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: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution 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. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package com.jogamp.opengl.test.junit.jogl.caps; - -import com.jogamp.newt.opengl.GLWindow; -import com.jogamp.opengl.test.junit.util.MiscUtils; -import javax.media.opengl.*; -import org.junit.Test; - -public class TestMultisampleNEWT { - static long durationPerTest = 500; // ms - private GLWindow window; - - public static void main(String[] args) { - for(int i=0; i0) { - caps.setSampleBuffers(true); - caps.setNumSamples(4); - } - // turns out we need to have alpha, - // otherwise no AA will be visible. - // This is done implicit now .. - // caps.setAlphaBits(1); - - window = GLWindow.create(caps); - window.setCapabilitiesChooser(chooser); - window.addGLEventListener(new MultisampleDemo01(samples>0?true:false)); - window.setSize(512, 512); - window.setVisible(true); - window.setPosition(0, 0); - window.requestFocus(); - - GLCapabilitiesImmutable capsChosen0 = window.getChosenGLCapabilities(); - - Thread.sleep(durationPerTest); - - window.destroy(); - } - -} -- cgit v1.2.3