summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-02-24 02:40:10 +0100
committerSven Gothel <[email protected]>2012-02-24 02:40:10 +0100
commit5940f88b19a375bd20432be01bde02cda065fbce (patch)
treeff3b7cdc7522a23ccbbd389a74faf2ceccf62fb7
parent29ee4fa97a7e17fe2eb07797350200300d8126d7 (diff)
Fix MultisampleDemo01 -> MultisampleDemoES1 (proper profile, remove immediate mode for ES1) ; Fix GLES1Impl.glOrtho()
-rw-r--r--make/config/jogl/gl-es1.cfg2
-rwxr-xr-xmake/scripts/targetcommand-1.sh10
-rwxr-xr-xmake/scripts/tests.sh8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleDemoES1.java (renamed from src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleDemo01.java)54
-rwxr-xr-xsrc/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1AWT.java (renamed from src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleAWT.java)10
-rwxr-xr-xsrc/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1NEWT.java (renamed from src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleNEWT.java)19
6 files changed, 62 insertions, 41 deletions
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/MultisampleDemoES1.java
index ab0171cb8..0aaf4b020 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleDemo01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleDemoES1.java
@@ -45,29 +45,33 @@ 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 {
+import com.jogamp.opengl.util.ImmModeSink;
+
+class MultisampleDemoES1 implements GLEventListener {
static boolean glDebug = false;
static boolean glTrace = false;
boolean multisample;
+ ImmModeSink immModeSink;
- public MultisampleDemo01(boolean multisample) {
+ public MultisampleDemoES1(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("Requested: " + drawable.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities());
+ System.err.println();
+ System.err.println("Chosen : " + drawable.getChosenGLCapabilities());
System.err.println();
- if (NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(false))) {
+ 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];
@@ -80,16 +84,16 @@ class MultisampleDemo01 implements GLEventListener {
if (glDebug) {
try {
// Debug ..
- _gl = _gl.getContext().setGL(GLPipelineFactory.create("javax.media.opengl.Debug", GL2.class, _gl, null));
+ _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", GL2.class, _gl, new Object[]{System.err}));
+ _gl = _gl.getContext().setGL(GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES1.class, _gl, new Object[]{System.err}));
}
} catch (Exception e) {
e.printStackTrace();
}
}
- GL2 gl = _gl.getGL2();
+ GL2ES1 gl = _gl.getGL2ES1();
if (multisample) {
gl.glEnable(GL.GL_MULTISAMPLE);
}
@@ -104,26 +108,38 @@ class MultisampleDemo01 implements GLEventListener {
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) {
- GL2 gl = drawable.getGL().getGL2();
+ GL2ES1 gl = drawable.getGL().getGL2ES1();
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();
+ immModeSink.draw(gl, true);
if (multisample) {
gl.glDisable(GL.GL_MULTISAMPLE);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1AWT.java
index 786fd608b..517d12578 100755
--- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1AWT.java
@@ -46,6 +46,7 @@ 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;
@@ -54,7 +55,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import org.junit.Test;
-public class TestMultisampleAWT extends UITestCase {
+public class TestMultisampleES1AWT extends UITestCase {
static long durationPerTest = 250; // ms
private GLCanvas canvas;
@@ -65,7 +66,7 @@ public class TestMultisampleAWT extends UITestCase {
}
}
System.out.println("durationPerTest: "+durationPerTest);
- String tstname = TestMultisampleAWT.class.getName();
+ String tstname = TestMultisampleES1AWT.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
@@ -80,7 +81,8 @@ public class TestMultisampleAWT extends UITestCase {
}
private void testMultiSampleAAImpl(int samples) throws InterruptedException, InvocationTargetException {
- GLCapabilities caps = new GLCapabilities(null);
+ GLProfile glp = GLProfile.getMaxFixedFunc(true);
+ GLCapabilities caps = new GLCapabilities(glp);
GLCapabilitiesChooser chooser = new MultisampleChooser01();
if(samples>0) {
@@ -92,7 +94,7 @@ public class TestMultisampleAWT extends UITestCase {
}
canvas = new GLCanvas(caps, chooser, null, null);
- canvas.addGLEventListener(new MultisampleDemo01(samples>0?true:false));
+ canvas.addGLEventListener(new MultisampleDemoES1(samples>0?true:false));
final Frame frame = new Frame("Multi Samples "+samples);
frame.setLayout(new BorderLayout());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1NEWT.java
index 1e3274dbb..cdfeb2bad 100755
--- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1NEWT.java
@@ -40,12 +40,16 @@
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;
-import javax.media.opengl.*;
-import org.junit.Test;
-public class TestMultisampleNEWT {
+public class TestMultisampleES1NEWT {
static long durationPerTest = 500; // ms
private GLWindow window;
@@ -56,7 +60,7 @@ public class TestMultisampleNEWT {
}
}
System.out.println("durationPerTest: "+durationPerTest);
- String tstname = TestMultisampleNEWT.class.getName();
+ String tstname = TestMultisampleES1NEWT.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
@@ -71,7 +75,8 @@ public class TestMultisampleNEWT {
}
private void testMultiSampleAAImpl(int samples) throws InterruptedException {
- GLCapabilities caps = new GLCapabilities(null);
+ GLProfile glp = GLProfile.getMaxFixedFunc(true);
+ GLCapabilities caps = new GLCapabilities(glp);
GLCapabilitiesChooser chooser = new MultisampleChooser01();
if(samples>0) {
@@ -85,14 +90,12 @@ public class TestMultisampleNEWT {
window = GLWindow.create(caps);
window.setCapabilitiesChooser(chooser);
- window.addGLEventListener(new MultisampleDemo01(samples>0?true:false));
+ window.addGLEventListener(new MultisampleDemoES1(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();