aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-02-14 01:36:18 +0100
committerSven Gothel <[email protected]>2012-02-14 01:36:18 +0100
commitd78828c86dc55503fd739befb82501c78b0eb3b5 (patch)
tree43fa180c0d0b5959c030d4dd0fc16c41ba80796d
parent0b316f93e9c633c44e9f7783d4748aa0d263f4fd (diff)
Simplify TestTransformFeedbackVaryingsBug407NEWT: Use 'in thread' ctx flow and debug context.
-rwxr-xr-xmake/scripts/java-win64-dbg.bat2
-rwxr-xr-xmake/scripts/tests-x64.bat4
-rwxr-xr-xmake/scripts/tests.sh5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java131
4 files changed, 55 insertions, 87 deletions
diff --git a/make/scripts/java-win64-dbg.bat b/make/scripts/java-win64-dbg.bat
index b1eac9f80..0c0d3ba6a 100755
--- a/make/scripts/java-win64-dbg.bat
+++ b/make/scripts/java-win64-dbg.bat
@@ -16,7 +16,7 @@ set CP_ALL=.;%BLD_DIR%\jar\jogl.all.jar;%BLD_DIR%\jar\jogl.test.jar;..\..\gluege
echo CP_ALL %CP_ALL%
REM set D_ARGS="-Djogl.debug.ExtensionAvailabilityCache" "-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.ProcAddressHelper=true" "-Djogamp.debug.NativeLibrary=true" "-Djogamp.debug.NativeLibrary.Lookup=true"
-set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.NativeLibrary=true"
+REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.NativeLibrary=true"
REM set D_ARGS="-Djogl.debug.GLContext" "-Djogl.debug.ExtensionAvailabilityCache" "-Djogamp.debug.ProcAddressHelper=true"
REM set D_ARGS="-Djogl.debug.GraphicsConfiguration"
REM set D_ARGS="-Djogamp.debug.JNILibLoader=true" "-Djogamp.debug.NativeLibrary=true" "-Djogamp.debug.NativeLibrary.Lookup=true" "-Djogl.debug.GLProfile=true"
diff --git a/make/scripts/tests-x64.bat b/make/scripts/tests-x64.bat
index b023baddd..7d6903d96 100755
--- a/make/scripts/tests-x64.bat
+++ b/make/scripts/tests-x64.bat
@@ -11,7 +11,7 @@ REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedCon
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT2 %*
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT %*
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT %*
-scripts\java-win32-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile02NEWT %*
+REM scripts\java-win32-dbg.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile02NEWT %*
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNewtAWTWrapper %*
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNEWT -time 30000
@@ -24,7 +24,7 @@ REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.T
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsGLJPanelAWT -time 5000
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.awt.TestAWT03GLCanvasRecreate01
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.newt.TestSwingAWTRobotUsageBeforeJOGLInitBug411
-REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.glsl.TestTransformFeedbackVaryingsBug407NEWT
+scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.glsl.TestTransformFeedbackVaryingsBug407NEWT
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLSimple01NEWT -time 2000
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.TestParenting01AWT
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index ec5109813..931d5f1fc 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -184,7 +184,6 @@ 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.TestGLProfile02NEWT $*
#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 $*
@@ -292,7 +291,7 @@ function testawtswt() {
#testawt $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestTransformFeedbackVaryingsBug407NEWT $*
+testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestTransformFeedbackVaryingsBug407NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLSimple01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState02NEWT $*
@@ -332,7 +331,7 @@ function testawtswt() {
# osx:
#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLnAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT $*
-testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer01GLCanvasAWT $*
+#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer01GLCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer02NewtCanvasAWT $*
$spath/count-edt-start.sh java-run.log
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java
index a3059baae..aefb6eb03 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java
@@ -1,25 +1,23 @@
package com.jogamp.opengl.test.junit.jogl.glsl;
+import com.jogamp.opengl.test.junit.util.NEWTGLContext;
import com.jogamp.opengl.test.junit.util.UITestCase;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
+import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES2;
import javax.media.opengl.GL3;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLContext;
+import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
import org.junit.Assert;
-import org.junit.Assume;
-import org.junit.BeforeClass;
import org.junit.Test;
-import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.util.glsl.ShaderUtil;
import java.io.IOException;
-import org.junit.AfterClass;
/**
* Bug 'Function glTransformFeedbackVaryings incorrectly passes argument'
@@ -27,7 +25,16 @@ import org.junit.AfterClass;
*/
public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase {
- private String VERTEX_SHADER_TEXT;
+ private static final boolean debugGL = true;
+
+ private static final String VERTEX_SHADER_TEXT =
+ "#version 150 \n"
+ + " \n"
+ + "out vec4 Position; \n"
+ + " \n"
+ + "void main() { \n"
+ + " Position = vec4(1.0, 1.0, 1.0, 1.0); \n"
+ + "} \n";
class MyShader {
int shaderProgram;
@@ -39,7 +46,7 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase {
}
}
- private MyShader getShader(GL3 gl, String text, int type) {
+ private MyShader attachShader(GL3 gl, String text, int type) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream pbaos = new PrintStream(baos);
@@ -52,13 +59,14 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase {
gl.glShaderSource(vertShader, lines.length, lines, lengths, 0);
gl.glCompileShader(vertShader);
- if(!ShaderUtil.isShaderStatusValid(gl, vertShader, gl.GL_COMPILE_STATUS, pbaos)) {
+ if(!ShaderUtil.isShaderStatusValid(gl, vertShader, GL2ES2.GL_COMPILE_STATUS, pbaos)) {
System.out.println("getShader:postCompile: "+baos.toString());
Assert.assertTrue(false);
}
pbaos.flush(); baos.reset();
gl.glAttachShader(shaderProgram, vertShader);
+ Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
return new MyShader(shaderProgram, vertShader);
}
@@ -69,84 +77,52 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase {
gl.glDeleteShader(myShader.vertShader);
gl.glDeleteProgram(myShader.shaderProgram);
}
+ Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
}
-
- private GLWindow prepareTest() {
- if(!GLProfile.isAvailable(GLProfile.GL3)) {
+ final static String glps = GLProfile.GL3;
+
+ private NEWTGLContext.WindowContext prepareTest() throws GLException, InterruptedException {
+ final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.get(GLProfile.GL4), 480, 480, debugGL);
+ // final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getDefault(), 480, 480, debugGL);
+ if(!winctx.context.getGL().isGL3()) {
System.err.println("GL3 not available");
- System.err.println(GLProfile.glAvailabilityToString());
+ cleanupTest(winctx);
return null;
}
- VERTEX_SHADER_TEXT =
- "#version 150 \n"
- + " \n"
- + "out vec4 Position; \n"
- + " \n"
- + "void main() { \n"
- + " Position = vec4(1.0, 1.0, 1.0, 1.0); \n"
- + "} \n";
-
- GLCapabilities caps;
-
- GLProfile glp = null;
- try {
- glp = GLProfile.get(GLProfile.GL3);
- } catch (Throwable t) {
- t.printStackTrace();
- Assume.assumeNoException(t);
- }
- caps = new GLCapabilities(glp);
-
- caps.setOnscreen(true);
- caps.setDoubleBuffered(true);
-
- GLWindow window = GLWindow.create(caps);
- Assert.assertNotNull(window);
- window.setUndecorated(true);
- window.setSize(800, 600);
- window.setVisible(true);
- Assert.assertTrue(window.isNativeValid());
-
- window.getContext().setSynchronized(true);
-
- // trigger native creation of drawable/context
- window.display();
- Assert.assertTrue(window.isRealized());
- Assert.assertTrue(window.getContext().isCreated());
-
- return window;
+ Assert.assertEquals(GL.GL_NO_ERROR, winctx.context.getGL().glGetError());
+ return winctx;
}
- private void cleanupTest(GLWindow window) {
- if(null!=window) {
- window.destroy();
+ private void cleanupTest(NEWTGLContext.WindowContext winctx) {
+ if(null!=winctx) {
+ NEWTGLContext.destroyWindow(winctx);
}
}
@Test(timeout=60000)
- public void testGlTransformFeedbackVaryings_WhenVarNameOK() {
- if(!GLProfile.isAvailable(GLProfile.GL3)) {
+ public void testGlTransformFeedbackVaryings_WhenVarNameOK() throws GLException, InterruptedException {
+ NEWTGLContext.WindowContext winctx = prepareTest();
+ if(null == winctx) {
return;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream pbaos = new PrintStream(baos);
- GLWindow window = prepareTest();
- GLContext context = window.getContext();
- context.makeCurrent();
-
// given
- GL3 gl = context.getGL().getGL3();
- MyShader myShader = getShader(gl, VERTEX_SHADER_TEXT, GL3.GL_VERTEX_SHADER);
+ final GL3 gl = winctx.context.getGL().getGL3();
+ Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
+
+ MyShader myShader = attachShader(gl, VERTEX_SHADER_TEXT, GL3.GL_VERTEX_SHADER);
String[] vars = new String[]{"Position"};
// when
gl.glTransformFeedbackVaryings(myShader.shaderProgram, 1, vars, GL3.GL_SEPARATE_ATTRIBS);
gl.glLinkProgram(myShader.shaderProgram);
-
+ Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
+
// then
boolean error = false;
@@ -156,32 +132,28 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase {
error = true;
}
pbaos.flush(); baos.reset();
-
Assert.assertEquals(GL3.GL_NO_ERROR, gl.glGetError());
- releaseShader(gl, myShader);
- context.release();
- cleanupTest(window);
-
+ releaseShader(gl, myShader);
+ cleanupTest(winctx);
Assert.assertFalse(error);
}
@Test(timeout=60000)
- public void testGlTransformFeedbackVaryings_WhenVarNameWrong() {
- if(!GLProfile.isAvailable(GLProfile.GL3)) {
+ public void testGlTransformFeedbackVaryings_WhenVarNameWrong() throws GLException, InterruptedException {
+ NEWTGLContext.WindowContext winctx = prepareTest();
+ if(null == winctx) {
return;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream pbaos = new PrintStream(baos);
- GLWindow window = prepareTest();
- GLContext context = window.getContext();
- context.makeCurrent();
-
// given
- GL3 gl = context.getGL().getGL3();
- MyShader myShader = getShader(gl, VERTEX_SHADER_TEXT, GL3.GL_VERTEX_SHADER);
+ final GL3 gl = winctx.context.getGL().getGL3();
+ Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
+
+ MyShader myShader = attachShader(gl, VERTEX_SHADER_TEXT, GL3.GL_VERTEX_SHADER);
String[] vars = new String[]{"PPPosition"};
// when
@@ -202,13 +174,10 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase {
error = true;
}
pbaos.flush(); baos.reset();
-
Assert.assertEquals(GL3.GL_NO_ERROR, gl.glGetError());
- // You cannot assume this error message - Assert.assertTrue(baos.toString().contains("(named PPPosition)"));
-
+
releaseShader(gl, myShader);
- context.release();
- cleanupTest(window);
+ cleanupTest(winctx);
Assert.assertFalse(error);
}