diff options
author | Sven Gothel <[email protected]> | 2011-04-28 08:15:11 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-04-28 08:15:11 +0200 |
commit | a34adb62a78c033a5caf27f3660b18bfc3e59edd (patch) | |
tree | 54e1c99cc2e54ab74b8691658ea2789b2cbc97a5 /src | |
parent | a66acbec16c339db66d5f9242f44b3b539808b99 (diff) |
Fix glsl unit tests: NV needs to have explicitly turn off vsync / Fix 'sed' havoc: gcu_ -> mgl_ uniform names
Diffstat (limited to 'src')
4 files changed, 32 insertions, 19 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquare0.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquare0.java index ce927ddc7..3e08f0e82 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquare0.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquare0.java @@ -58,16 +58,16 @@ public class RedSquare0 implements GLEventListener { myShader = GLSLSimpleProgram.create(gl, RedSquareShader.VERTEX_SHADER_TEXT, RedSquareShader.FRAGMENT_SHADER_TEXT, true); gl.glUseProgram(myShader.getShaderProgram()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - // setup gcu_PMVMatrix + // setup mgl_PMVMatrix pmvMatrix = new PMVMatrix(); pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); pmvMatrix.glLoadIdentity(); pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); - mgl_PMVMatrix = gl.glGetUniformLocation(myShader.getShaderProgram(), "gcu_PMVMatrix"); + mgl_PMVMatrix = gl.glGetUniformLocation(myShader.getShaderProgram(), "mgl_PMVMatrix"); Assert.assertTrue(0 <= mgl_PMVMatrix); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - pmvMatrixUniform = new GLUniformData("gcu_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); + pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); pmvMatrixUniform.setLocation(mgl_PMVMatrix); gl.glUniform(pmvMatrixUniform); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java index ca781f4ce..3ef62df31 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java @@ -38,7 +38,7 @@ public class RedSquareShader { " #define HIGHP\n" + "#endif\n" + "\n" + - "uniform MEDIUMP mat4 gcu_PMVMatrix[2];\n" + + "uniform MEDIUMP mat4 mgl_PMVMatrix[2];\n" + "attribute HIGHP vec4 mgl_Vertex;\n" + "attribute HIGHP vec4 mgl_Color;\n" + "varying HIGHP vec4 frontColor;\n" + @@ -46,7 +46,7 @@ public class RedSquareShader { "void main(void)\n" + "{\n" + " frontColor=mgl_Color;\n" + - " gl_Position = gcu_PMVMatrix[0] * gcu_PMVMatrix[1] * mgl_Vertex;\n" + + " gl_Position = mgl_PMVMatrix[0] * mgl_PMVMatrix[1] * mgl_Vertex;\n" + "}\n" ; public static String FRAGMENT_SHADER_TEXT = 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 9bce30285..096496d87 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 @@ -62,6 +62,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase { GLSLMiscHelper.WindowContext winctx = GLSLMiscHelper.createWindow(GLProfile.getGL2ES2(), true); GLDrawable drawable = winctx.context.getGLDrawable(); GL2ES2 gl = winctx.context.getGL().getGL2ES2(); + System.err.println(winctx.context); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); @@ -116,15 +117,15 @@ public class TestGLSLShaderState01NEWT extends UITestCase { Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); Assert.assertEquals(st, ShaderState.getShaderState(gl)); - // setup gcu_PMVMatrix + // setup mgl_PMVMatrix PMVMatrix pmvMatrix = new PMVMatrix(); - GLUniformData pmvMatrixUniform = new GLUniformData("gcu_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); + GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); st.ownUniform(pmvMatrixUniform); st.uniform(gl, pmvMatrixUniform); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - Assert.assertEquals(pmvMatrixUniform, st.getUniform("gcu_PMVMatrix")); + Assert.assertEquals(pmvMatrixUniform, st.getUniform("mgl_PMVMatrix")); // Allocate Vertex Array1 GLArrayDataServer vertices1 = GLSLMiscHelper.createRSVertices1(gl, st); @@ -153,6 +154,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase { pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); st.uniform(gl, pmvMatrixUniform); + gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); // display #1 vertices0 / colors0 (post-disable) @@ -184,6 +186,8 @@ public class TestGLSLShaderState01NEWT extends UITestCase { GLSLMiscHelper.WindowContext winctx = GLSLMiscHelper.createWindow(GLProfile.getGL2ES2(), false); GLDrawable drawable = winctx.context.getGLDrawable(); GL2ES2 gl = winctx.context.getGL().getGL2ES2(); + System.err.println(winctx.context); + gl.setSwapInterval(0); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); @@ -205,9 +209,9 @@ public class TestGLSLShaderState01NEWT extends UITestCase { st.attachShaderProgram(gl, sp); st.useProgram(gl, true); - // setup gcu_PMVMatrix + // setup mgl_PMVMatrix PMVMatrix pmvMatrix = new PMVMatrix(); - GLUniformData pmvMatrixUniform = new GLUniformData("gcu_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); + GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); st.ownUniform(pmvMatrixUniform); st.uniform(gl, pmvMatrixUniform); @@ -233,6 +237,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase { pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); st.uniform(gl, pmvMatrixUniform); + gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); long t0 = System.currentTimeMillis(); int frames; @@ -267,7 +272,9 @@ public class TestGLSLShaderState01NEWT extends UITestCase { GLSLMiscHelper.WindowContext winctx = GLSLMiscHelper.createWindow(GLProfile.getGL2ES2(), false); GLDrawable drawable = winctx.context.getGLDrawable(); GL2ES2 gl = winctx.context.getGL().getGL2ES2(); - + System.err.println(winctx.context); + gl.setSwapInterval(0); + Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); // test code .. @@ -288,9 +295,9 @@ public class TestGLSLShaderState01NEWT extends UITestCase { st.attachShaderProgram(gl, sp); st.useProgram(gl, true); - // setup gcu_PMVMatrix + // setup mgl_PMVMatrix PMVMatrix pmvMatrix = new PMVMatrix(); - GLUniformData pmvMatrixUniform = new GLUniformData("gcu_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); + GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); st.ownUniform(pmvMatrixUniform); st.uniform(gl, pmvMatrixUniform); @@ -326,6 +333,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase { pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); st.uniform(gl, pmvMatrixUniform); + gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); // validation .. GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices0, colors0, true, 1, 0); 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 7e8fb7c3d..1c0f028a2 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 @@ -73,6 +73,7 @@ public class TestGLSLShaderState02NEWT extends UITestCase { GLSLMiscHelper.WindowContext winctx = GLSLMiscHelper.createWindow(GLProfile.getGL2ES2(), true); GLDrawable drawable = winctx.context.getGLDrawable(); GL2ES2 gl = winctx.context.getGL().getGL2ES2(); + System.err.println(winctx.context); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); @@ -148,15 +149,15 @@ public class TestGLSLShaderState02NEWT extends UITestCase { Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); Assert.assertEquals(st, ShaderState.getShaderState(gl)); - // setup gcu_PMVMatrix + // setup mgl_PMVMatrix PMVMatrix pmvMatrix = new PMVMatrix(); - GLUniformData pmvMatrixUniform = new GLUniformData("gcu_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); + GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); st.ownUniform(pmvMatrixUniform); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); st.uniform(gl, pmvMatrixUniform); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - Assert.assertEquals(pmvMatrixUniform, st.getUniform("gcu_PMVMatrix")); + Assert.assertEquals(pmvMatrixUniform, st.getUniform("mgl_PMVMatrix")); // Allocate Vertex Array1 GLArrayDataServer vertices1 = GLSLMiscHelper.createRSVertices1(gl, st); @@ -183,6 +184,7 @@ public class TestGLSLShaderState02NEWT extends UITestCase { pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); st.uniform(gl, pmvMatrixUniform); + gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); // display #1 vertices0 / colors0 (post-disable) @@ -229,6 +231,8 @@ public class TestGLSLShaderState02NEWT extends UITestCase { GLSLMiscHelper.WindowContext winctx = GLSLMiscHelper.createWindow(GLProfile.getGL2ES2(), false); GLDrawable drawable = winctx.context.getGLDrawable(); GL2ES2 gl = winctx.context.getGL().getGL2ES2(); + System.err.println(winctx.context); + gl.setSwapInterval(0); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); @@ -260,9 +264,9 @@ public class TestGLSLShaderState02NEWT extends UITestCase { st.attachShaderProgram(gl, sp0); st.useProgram(gl, true); - // setup gcu_PMVMatrix + // setup mgl_PMVMatrix PMVMatrix pmvMatrix = new PMVMatrix(); - GLUniformData pmvMatrixUniform = new GLUniformData("gcu_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); + GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); st.ownUniform(pmvMatrixUniform); st.uniform(gl, pmvMatrixUniform); @@ -298,6 +302,7 @@ public class TestGLSLShaderState02NEWT extends UITestCase { pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); st.uniform(gl, pmvMatrixUniform); + gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); // validation .. st.attachShaderProgram(gl, sp0); @@ -323,7 +328,7 @@ public class TestGLSLShaderState02NEWT extends UITestCase { // SP0 st.attachShaderProgram(gl, sp0); GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices0, colors0, true); - GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices1, colors1, true); + GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices1, colors1, true); // SP1 st.attachShaderProgram(gl, sp1); GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices0, colors0, true); |