From d97c54896d349e8a22c9cafec75c62476c16fdd1 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 20 Feb 2012 14:43:13 +0100 Subject: Fix commit fb7165e690546359dee92dd60b04be69f141c87e; Clarify ShaderState.attachShaderProgram(..) --- .../test/junit/jogl/glsl/TestFBOMRTNEWT01.java | 9 ++++----- .../junit/jogl/glsl/TestGLSLShaderState01NEWT.java | 10 +++++----- .../junit/jogl/glsl/TestGLSLShaderState02NEWT.java | 23 ++++++++++++---------- .../test/junit/jogl/glsl/TestRulerNEWT01.java | 3 +-- 4 files changed, 23 insertions(+), 22 deletions(-) (limited to 'src/test/com/jogamp') diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java index aca1e6607..5c9ec0d82 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java @@ -84,7 +84,7 @@ public class TestFBOMRTNEWT01 extends UITestCase { Assert.assertTrue(!sp0.inUse()); Assert.assertTrue(!sp0.linked()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - st.attachShaderProgram(gl, sp0); + st.attachShaderProgram(gl, sp0, false); final ShaderCode vp1 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, RedSquareES2.class, "shader", "shader/bin", "fbo-mrt-2"); @@ -97,8 +97,7 @@ public class TestFBOMRTNEWT01 extends UITestCase { Assert.assertTrue(!sp1.inUse()); Assert.assertTrue(!sp1.linked()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - st.attachShaderProgram(gl, sp1); - st.useProgram(gl, true); + st.attachShaderProgram(gl, sp1, true); final PMVMatrix pmvMatrix = new PMVMatrix(); final GLUniformData pmvMatrixUniform = new GLUniformData("gcu_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); @@ -175,7 +174,7 @@ public class TestFBOMRTNEWT01 extends UITestCase { for(int i=0; i buffer0, Green -> buffer1 - st.attachShaderProgram(gl, sp0); + st.attachShaderProgram(gl, sp0, true); vertices0.enableBuffer(gl, true); colors0.enableBuffer(gl, true); @@ -191,7 +190,7 @@ public class TestFBOMRTNEWT01 extends UITestCase { // pass 2 - mix buffer0, buffer1 and blue // rg = buffer0.rg + buffer1.rg, b = Blue - length(rg); - st.attachShaderProgram(gl, sp1); + st.attachShaderProgram(gl, sp1, true); vertices0.enableBuffer(gl, true); colors0.enableBuffer(gl, true); texCoords0.enableBuffer(gl, true); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java index ea290693c..037a973f5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java @@ -88,7 +88,9 @@ public class TestGLSLShaderState01NEWT extends UITestCase { Assert.assertTrue(!sp.linked()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - st.attachShaderProgram(gl, sp); + st.attachShaderProgram(gl, sp, false); + Assert.assertTrue(!sp.inUse()); + Assert.assertTrue(!sp.linked()); Assert.assertEquals(null, ShaderState.getShaderState(gl)); st.setShaderState(gl); // pre-use attach @@ -211,8 +213,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase { sp.init(gl); Assert.assertTrue(sp.link(gl, System.err)); - st.attachShaderProgram(gl, sp); - st.useProgram(gl, true); + st.attachShaderProgram(gl, sp, true); // setup mgl_PMVMatrix final PMVMatrix pmvMatrix = new PMVMatrix(); @@ -300,8 +301,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase { sp.init(gl); Assert.assertTrue(sp.link(gl, System.err)); - st.attachShaderProgram(gl, sp); - st.useProgram(gl, true); + st.attachShaderProgram(gl, sp, true); // setup mgl_PMVMatrix final PMVMatrix pmvMatrix = new PMVMatrix(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java index fb52ff04b..0efb63dca 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java @@ -114,7 +114,9 @@ public class TestGLSLShaderState02NEWT extends UITestCase { Assert.assertTrue(!sp0.linked()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - st.attachShaderProgram(gl, sp0); + st.attachShaderProgram(gl, sp0, false); + Assert.assertTrue(!sp0.inUse()); + Assert.assertTrue(!sp0.linked()); Assert.assertEquals(null, ShaderState.getShaderState(gl)); st.setShaderState(gl); // pre-use attach Assert.assertEquals(st, ShaderState.getShaderState(gl)); @@ -200,7 +202,9 @@ public class TestGLSLShaderState02NEWT extends UITestCase { GLSLMiscHelper.displayVCArrays(drawable, gl, true, vertices1, colors1, true, 4, durationPerTest); // SP1 - st.attachShaderProgram(gl, sp1); + st.attachShaderProgram(gl, sp1, true); + Assert.assertTrue(sp1.inUse()); + Assert.assertTrue(sp1.linked()); if(!linkSP1) { // all attribute locations shall be same now, due to impl. glBindAttributeLocation @@ -267,8 +271,7 @@ public class TestGLSLShaderState02NEWT extends UITestCase { sp0.init(gl); Assert.assertTrue(sp0.link(gl, System.err)); - st.attachShaderProgram(gl, sp0); - st.useProgram(gl, true); + st.attachShaderProgram(gl, sp0, true); // setup mgl_PMVMatrix final PMVMatrix pmvMatrix = new PMVMatrix(); @@ -313,20 +316,20 @@ public class TestGLSLShaderState02NEWT extends UITestCase { gl.setSwapInterval(0); // validation .. - st.attachShaderProgram(gl, sp0); + st.attachShaderProgram(gl, sp0, true); GLSLMiscHelper.displayVCArrays(drawable, gl, true, vertices0, colors0, true, 1, 0); GLSLMiscHelper.displayVCArrays(drawable, gl, true, vertices1, colors1, true, 2, 0); - st.attachShaderProgram(gl, sp1); + st.attachShaderProgram(gl, sp1, true); GLSLMiscHelper.displayVCArrays(drawable, gl, true, vertices0, colors0, true, 1, 0); GLSLMiscHelper.displayVCArrays(drawable, gl, true, vertices1, colors1, true, 2, 0); // warmup .. for(int frames=0; frames