diff options
Diffstat (limited to 'src/test/com/jogamp/opengl')
15 files changed, 155 insertions, 128 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAO.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAO.java index 95944cd98..de5db0ae2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAO.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAO.java @@ -152,7 +152,7 @@ public class TestBug692GL3VAO extends UITestCase { }
private void initShaders(GL3 gl) {
final String[] vertSrc = new String[]{
- "#version 150 core\n",
+ "#version 150\n",
"in vec4 vPosition;\n",
"in vec4 vColor;\n",
"out vec4 pColor;\n",
@@ -164,7 +164,7 @@ public class TestBug692GL3VAO extends UITestCase { vertID = createShader(gl, GL3.GL_VERTEX_SHADER, vertSrc);
final String[] fragSrc = new String[]{
- "#version 150 core\n",
+ "#version 150\n",
"in vec4 pColor;\n",
"void main() {\n",
" gl_FragColor = pColor;\n",
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java index e5075bbea..387e152ce 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java @@ -82,9 +82,11 @@ public class TestFBOMRTNEWT01 extends UITestCase { // st.setVerbose(true); final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RedSquareES2.class, "shader", - "shader/bin", "fbo-mrt-1", false); + "shader/bin", "fbo-mrt-1", true); final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RedSquareES2.class, "shader", - "shader/bin", "fbo-mrt-1", false); + "shader/bin", "fbo-mrt-1", true); + vp0.defaultShaderCustomization(gl, true, true); + fp0.defaultShaderCustomization(gl, true, true); final ShaderProgram sp0 = new ShaderProgram(); sp0.add(gl, vp0, System.err); sp0.add(gl, fp0, System.err); @@ -95,9 +97,11 @@ public class TestFBOMRTNEWT01 extends UITestCase { st.attachShaderProgram(gl, sp0, false); final ShaderCode vp1 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RedSquareES2.class, "shader", - "shader/bin", "fbo-mrt-2", false); + "shader/bin", "fbo-mrt-2", true); final ShaderCode fp1 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RedSquareES2.class, "shader", - "shader/bin", "fbo-mrt-2", false); + "shader/bin", "fbo-mrt-2", true); + vp1.defaultShaderCustomization(gl, true, true); + fp1.defaultShaderCustomization(gl, true, true); final ShaderProgram sp1 = new ShaderProgram(); sp1.add(gl, vp1, System.err); sp1.add(gl, fp1, System.err); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java index cb3eb4351..cc8927c24 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java @@ -450,7 +450,9 @@ public class ElektronenMultiplizierer implements GLEventListener { st.uniform(gl, en.setData(mEffectNumber)); st.uniform(gl, et.setData(mEffectTime)); - gl.glEnable(GL_TEXTURE_2D); + if( !gl.isGLcore() ) { + gl.glEnable(GL_TEXTURE_2D); + } gl.glBindTexture(GL_TEXTURE_2D, mFrameBufferTextureID); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java index 9d2c73f08..add11ff8c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java @@ -90,9 +90,6 @@ public class FBOMix2DemosES2 implements GLEventListener { public void setDoRotation(boolean rotate) { demo1.setDoRotation(rotate); } - static final String[] es2_prelude = { "#version 100\n", "precision mediump float;\n" }; - static final String gl2_prelude = "#version 110\n"; - @Override public void init(GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); @@ -104,19 +101,8 @@ public class FBOMix2DemosES2 implements GLEventListener { "shader/bin", "texture01_xxx", true); final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, FBOMix2DemosES2.class, "shader", "shader/bin", "texture02_xxx", true); - - // Prelude shader code w/ GLSL profile specifics [ 1. pre-proc, 2. other ] - int fp0Pos; - if(gl.isGLES2()) { - vp0.insertShaderSource(0, 0, es2_prelude[0]); - fp0Pos = fp0.insertShaderSource(0, 0, es2_prelude[0]); - } else { - vp0.insertShaderSource(0, 0, gl2_prelude); - fp0Pos = fp0.insertShaderSource(0, 0, gl2_prelude); - } - if(gl.isGLES2()) { - fp0Pos = fp0.insertShaderSource(0, fp0Pos, es2_prelude[1]); - } + vp0.defaultShaderCustomization(gl, true, true); + fp0.defaultShaderCustomization(gl, true, true); sp0 = new ShaderProgram(); sp0.add(gl, vp0, System.err); @@ -260,7 +246,9 @@ public class FBOMix2DemosES2 implements GLEventListener { } interleavedVBO.enableBuffer(gl, true); - gl.glEnable(GL.GL_TEXTURE_2D); + if( !gl.isGLcore() ) { + gl.glEnable(GL.GL_TEXTURE_2D); + } gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java index cd40b5c6e..b69505457 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java @@ -77,9 +77,6 @@ public class Mix2TexturesES2 implements GLEventListener { } } - static final String[] es2_prelude = { "#version 100\n", "precision mediump float;\n" }; - static final String gl2_prelude = "#version 110\n"; - @Override public void init(GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); @@ -88,19 +85,8 @@ public class Mix2TexturesES2 implements GLEventListener { "shader/bin", "texture01_xxx", true); final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, Mix2TexturesES2.class, "shader", "shader/bin", null == texUnit1 ? "texture01_xxx" : "texture02_xxx", true); - - // Prelude shader code w/ GLSL profile specifics [ 1. pre-proc, 2. other ] - int fp0Pos; - if(gl.isGLES2()) { - vp0.insertShaderSource(0, 0, es2_prelude[0]); - fp0Pos = fp0.insertShaderSource(0, 0, es2_prelude[0]); - } else { - vp0.insertShaderSource(0, 0, gl2_prelude); - fp0Pos = fp0.insertShaderSource(0, 0, gl2_prelude); - } - if(gl.isGLES2()) { - fp0Pos = fp0.insertShaderSource(0, fp0Pos, es2_prelude[1]); - } + vp0.defaultShaderCustomization(gl, true, true); + fp0.defaultShaderCustomization(gl, true, true); sp0 = new ShaderProgram(); sp0.add(gl, vp0, System.err); @@ -172,7 +158,9 @@ public class Mix2TexturesES2 implements GLEventListener { gl.glBindTexture(GL.GL_TEXTURE_2D, texID1); } - gl.glEnable(GL.GL_TEXTURE_2D); + if( !gl.isGLcore() ) { + gl.glEnable(GL.GL_TEXTURE_2D); + } gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java index 98641398d..430ea45c0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java @@ -69,9 +69,6 @@ public class MultisampleDemoES2 implements GLEventListener { pmvMatrix = new PMVMatrix(); } - static final String[] es2_prelude = { "#version 100\n", "precision mediump float;\n" }; - static final String gl2_prelude = "#version 110\n"; - public void init(GLAutoDrawable glad) { final GL2ES2 gl = glad.getGL().getGL2ES2(); @@ -87,19 +84,8 @@ public class MultisampleDemoES2 implements GLEventListener { "shader/bin", "mgl_default_xxx", true); final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MultisampleDemoES2.class, "shader", "shader/bin", "mgl_default_xxx", true); - - // Prelude shader code w/ GLSL profile specifics [ 1. pre-proc, 2. other ] - int fp0Pos; - if(gl.isGLES2()) { - vp0.insertShaderSource(0, 0, es2_prelude[0]); - fp0Pos = fp0.insertShaderSource(0, 0, es2_prelude[0]); - } else { - vp0.insertShaderSource(0, 0, gl2_prelude); - fp0Pos = fp0.insertShaderSource(0, 0, gl2_prelude); - } - if(gl.isGLES2()) { - fp0Pos = fp0.insertShaderSource(0, fp0Pos, es2_prelude[1]); - } + vp0.defaultShaderCustomization(gl, true, true); + fp0.defaultShaderCustomization(gl, true, true); sp0 = new ShaderProgram(); sp0.add(gl, vp0, System.err); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java index d8e3df5c0..20c28c3ea 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java @@ -27,7 +27,6 @@ */ package com.jogamp.opengl.test.junit.jogl.demos.es2; -import java.nio.ByteBuffer; import java.nio.FloatBuffer; import javax.media.opengl.GL; @@ -58,7 +57,7 @@ public class TextureSequenceCubeES2 implements GLEventListener { public TextureSequenceCubeES2 (TextureSequence texSource, boolean innerCube, float zoom0, float rotx, float roty) { this.texSeq = texSource; this.innerCube = innerCube; - this.zoom0 = zoom0; + this.zoom = zoom0; this.view_rotx = rotx; this.view_roty = roty; } @@ -71,11 +70,10 @@ public class TextureSequenceCubeES2 implements GLEventListener { private float nearPlaneNormalized; // private float zoom0=-5.0f, zoom=zoom0; // private float view_rotx = 20.0f, view_roty = 30.0f, view_rotz = 0.0f; - private float zoom0=-2.3f, zoom=zoom0; + private float zoom=-2.3f; private float view_rotx = 0.0f, view_roty = 0.0f, view_rotz = 0.0f; int[] vboNames = new int[4]; boolean innerCube; - private ByteBuffer cubeIndices; private final MouseListener mouseAction = new MouseAdapter() { int lx = 0; @@ -113,7 +111,12 @@ public class TextureSequenceCubeES2 implements GLEventListener { int nv = Math.abs(e.getY(0)-e.getY(1)); int dy = nv - lx; - zoom += 40f*Math.signum(dy)/(float)height; + { + final float o = zoom; + final float d = 40f*Math.signum(dy)/(float)height; + zoom += d; + System.err.println("zoom.d: "+o+" + "+d+" -> "+zoom); + } lx = nv; } else { @@ -133,15 +136,16 @@ public class TextureSequenceCubeES2 implements GLEventListener { } } public void mouseWheelMoved(MouseEvent e) { + System.err.println("XXX "+e); if( !e.isShiftDown() ) { - zoom += e.getRotation()[0]/10f; - System.err.println("zoom: "+zoom); + final float o = zoom; + final float d = e.getRotation()[1]/10f; // vertical: wheel + zoom += d; + System.err.println("zoom.w: "+o+" + "+d+" -> "+zoom); } } }; - static final String[] es2_prelude = { "#version 100\n", "precision mediump float;\n" }; - static final String gl2_prelude = "#version 110\n"; static final String shaderBasename = "texsequence_xxx"; static final String myTextureLookupName = "myTexture2D"; @@ -151,20 +155,12 @@ public class TextureSequenceCubeES2 implements GLEventListener { "shader", "shader/bin", shaderBasename, true); ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), "shader", "shader/bin", shaderBasename, true); - - // Prelude shader code w/ GLSL profile specifics [ 1. pre-proc, 2. other ] - int rsFpPos; - if(gl.isGLES2()) { - rsVp.insertShaderSource(0, 0, es2_prelude[0]); - rsFpPos = rsFp.insertShaderSource(0, 0, es2_prelude[0]); - } else { - rsVp.insertShaderSource(0, 0, gl2_prelude); - rsFpPos = rsFp.insertShaderSource(0, 0, gl2_prelude); - } + rsVp.defaultShaderCustomization(gl, true, true); + int rsFpPos = rsFp.addGLSLVersion(gl); + rsFpPos = rsFp.insertShaderSource(0, rsFpPos, texSeq.getRequiredExtensionsShaderStub()); - if(gl.isGLES2()) { - rsFpPos = rsFp.insertShaderSource(0, rsFpPos, es2_prelude[1]); - } + rsFpPos = rsFp.addDefaultShaderPrecision(gl, rsFpPos); + final String texLookupFuncName = texSeq.getTextureLookupFunctionName(myTextureLookupName); rsFp.replaceInShaderSource(myTextureLookupName, texLookupFuncName); @@ -187,7 +183,7 @@ public class TextureSequenceCubeES2 implements GLEventListener { st.attachShaderProgram(gl, sp, false); } - GLArrayDataServer interleavedVBO; + GLArrayDataServer interleavedVBO, cubeIndicesVBO; public void init(GLAutoDrawable drawable) { GL2ES2 gl = drawable.getGL().getGL2ES2(); @@ -260,7 +256,15 @@ public class TextureSequenceCubeES2 implements GLEventListener { interleavedVBO.seal(gl, true); interleavedVBO.enableBuffer(gl, false); st.ownAttribute(interleavedVBO, true); - cubeIndices = ByteBuffer.wrap(s_cubeIndices); + + cubeIndicesVBO = GLArrayDataServer.createData(6, GL.GL_UNSIGNED_SHORT, 6, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + for(int i=0; i<6*6; i++) { + cubeIndicesVBO.puts(s_cubeIndices[i]); + } + cubeIndicesVBO.seal(gl, true); + cubeIndicesVBO.enableBuffer(gl, false); + st.ownAttribute(cubeIndicesVBO, true); + gl.glEnable(GL2ES2.GL_DEPTH_TEST); @@ -324,7 +328,7 @@ public class TextureSequenceCubeES2 implements GLEventListener { pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); - pmvMatrix.glTranslatef(0, 0, zoom0); + pmvMatrix.glTranslatef(0, 0, zoom); } @@ -364,7 +368,10 @@ public class TextureSequenceCubeES2 implements GLEventListener { tex.bind(gl); } } - gl.glDrawElements(GL.GL_TRIANGLES, 6 * 6, GL.GL_UNSIGNED_BYTE, cubeIndices); + cubeIndicesVBO.bindBuffer(gl, true); // keeps VBO binding + gl.glDrawElements(GL2ES2.GL_TRIANGLES, cubeIndicesVBO.getElementCount() * cubeIndicesVBO.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + cubeIndicesVBO.bindBuffer(gl, false); + if(null != tex) { tex.disable(gl); } @@ -446,7 +453,7 @@ public class TextureSequenceCubeES2 implements GLEventListener { -1f, 0f, 0f, -1f, 0f, 0f, -1f, 0f, 0f, -1f, 0f, 0f };*/ - private static final byte[] s_cubeIndices = + private static final short[] s_cubeIndices = { 0, 3, 1, 2, 0, 1, /* front */ 6, 5, 4, 5, 7, 4, /* back */ diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java index b7c4e729e..ad096c7a6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java @@ -204,6 +204,11 @@ public class MovieCube implements GLEventListener, GLMediaEventListener { int height = 300; System.err.println("TexCubeES2.run()"); + boolean forceES2 = false; + boolean forceES3 = false; + boolean forceGL3 = false; + boolean forceGLDef = false; + String url_s="http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4"; for(int i=0; i<args.length; i++) { if(args[i].equals("-width")) { @@ -215,13 +220,39 @@ public class MovieCube implements GLEventListener, GLMediaEventListener { } else if(args[i].equals("-url")) { i++; url_s = args[i]; + } else if(args[i].equals("-es2")) { + forceES2 = true; + } else if(args[i].equals("-es3")) { + forceES3 = true; + } else if(args[i].equals("-gl3")) { + forceGL3 = true; + } else if(args[i].equals("-gldef")) { + forceGLDef = true; } else if(args[i].equals("-wait")) { waitForKey = true; } } + System.err.println("forceES2 "+forceES2); + System.err.println("forceES3 "+forceES3); + System.err.println("forceGL3 "+forceGL3); + System.err.println("forceGLDef "+forceGLDef); + final MovieCube mc = new MovieCube(new URL(url_s).openConnection(), -2.3f, 0f, 0f); - final GLWindow window = GLWindow.create(new GLCapabilities(GLProfile.getGL2ES2())); + final GLProfile glp; + if(forceGLDef) { + glp = GLProfile.getDefault(); + } else if(forceGL3) { + glp = GLProfile.get(GLProfile.GL3); + } else if(forceES3) { + glp = GLProfile.get(GLProfile.GLES3); + } else if(forceES2) { + glp = GLProfile.get(GLProfile.GLES2); + } else { + glp = GLProfile.getGL2ES2(); + } + System.err.println("GLProfile: "+glp); + final GLWindow window = GLWindow.create(new GLCapabilities(glp)); // Size OpenGL to Video Surface window.setSize(width, height); window.setFullscreen(false); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java index 6b618bd5b..5bf3145d0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java @@ -141,7 +141,7 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener { } public void mouseWheelMoved(MouseEvent e) { if( !e.isShiftDown() ) { - zoom += e.getRotation()[0]/10f; + zoom += e.getRotation()[1]/10f; // vertical: wheel System.err.println("zoom: "+zoom); } } @@ -200,8 +200,6 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener { ShaderState st; PMVMatrix pmvMatrix; GLUniformData pmvMatrixUniform; - static final String[] es2_prelude = { "#version 100\n", "precision mediump float;\n" }; - static final String gl2_prelude = "#version 110\n"; static final String shaderBasename = "texsequence_xxx"; static final String myTextureLookupName = "myTexture2D"; @@ -211,20 +209,12 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener { "../shader", "../shader/bin", shaderBasename, true); ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MovieSimple.class, "../shader", "../shader/bin", shaderBasename, true); + rsVp.defaultShaderCustomization(gl, true, true); + int rsFpPos = rsFp.addGLSLVersion(gl); - // Prelude shader code w/ GLSL profile specifics [ 1. pre-proc, 2. other ] - int rsFpPos; - if(gl.isGLES2()) { - rsVp.insertShaderSource(0, 0, es2_prelude[0]); - rsFpPos = rsFp.insertShaderSource(0, 0, es2_prelude[0]); - } else { - rsVp.insertShaderSource(0, 0, gl2_prelude); - rsFpPos = rsFp.insertShaderSource(0, 0, gl2_prelude); - } rsFpPos = rsFp.insertShaderSource(0, rsFpPos, mPlayer.getRequiredExtensionsShaderStub()); - if(gl.isGLES2()) { - rsFpPos = rsFp.insertShaderSource(0, rsFpPos, es2_prelude[1]); - } + rsFpPos = rsFp.addDefaultShaderPrecision(gl, rsFpPos); + final String texLookupFuncName = mPlayer.getTextureLookupFunctionName(myTextureLookupName); rsFp.replaceInShaderSource(myTextureLookupName, texLookupFuncName); @@ -519,6 +509,11 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener { boolean ortho = true; boolean zoom = false; + boolean forceES2 = false; + boolean forceES3 = false; + boolean forceGL3 = false; + boolean forceGLDef = false; + String url_s="http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4"; for(int i=0; i<args.length; i++) { if(args[i].equals("-width")) { @@ -527,6 +522,14 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener { } else if(args[i].equals("-height")) { i++; height = MiscUtils.atoi(args[i], height); + } else if(args[i].equals("-es2")) { + forceES2 = true; + } else if(args[i].equals("-es3")) { + forceES3 = true; + } else if(args[i].equals("-gl3")) { + forceGL3 = true; + } else if(args[i].equals("-gldef")) { + forceGLDef = true; } else if(args[i].equals("-projection")) { ortho=false; } else if(args[i].equals("-zoom")) { @@ -536,12 +539,30 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener { url_s = args[i]; } } + System.err.println("forceES2 "+forceES2); + System.err.println("forceES3 "+forceES3); + System.err.println("forceGL3 "+forceGL3); + System.err.println("forceGLDef "+forceGLDef); + final MovieSimple ms = new MovieSimple(new URL(url_s).openConnection()); ms.setScaleOrig(!zoom); ms.setOrthoProjection(ortho); try { - GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2()); + final GLProfile glp; + if(forceGLDef) { + glp = GLProfile.getDefault(); + } else if(forceGL3) { + glp = GLProfile.get(GLProfile.GL3); + } else if(forceES3) { + glp = GLProfile.get(GLProfile.GLES3); + } else if(forceES2) { + glp = GLProfile.get(GLProfile.GLES2); + } else { + glp = GLProfile.getGL2ES2(); + } + System.err.println("GLProfile: "+glp); + GLCapabilities caps = new GLCapabilities(glp); GLWindow window = GLWindow.create(caps); window.addGLEventListener(ms); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-1.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-1.fp index 1738d96d1..563e0a4b0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-1.fp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-1.fp @@ -1,11 +1,16 @@ //Copyright 2010 JogAmp Community. All rights reserved. -#version 110 +#if __VERSION__ >= 130 + #define varying in + out vec4 mgl_FragData[2]; +#else + #define mgl_FragData gl_FragData +#endif varying vec4 frontColor; void main (void) { - gl_FragData[0] = vec4( frontColor.r, 0.0, 0.0, 1.0 ); - gl_FragData[1] = vec4( 0.0, frontColor.g, 0.0, 1.0 ); + mgl_FragData[0] = vec4( frontColor.r, 0.0, 0.0, 1.0 ); + mgl_FragData[1] = vec4( 0.0, frontColor.g, 0.0, 1.0 ); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-1.vp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-1.vp index 7f95a650a..4cab59c64 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-1.vp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-1.vp @@ -1,6 +1,9 @@ // Copyright 2010 JogAmp Community. All rights reserved. -#version 110 +#if __VERSION__ >= 130 + #define attribute in + #define varying out +#endif uniform mat4 gcu_PMVMatrix[2]; // P, Mv, and Mvi attribute vec4 gca_Vertices; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-2.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-2.fp index deac58ce1..0087ca361 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-2.fp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-2.fp @@ -1,6 +1,11 @@ //Copyright 2010 JogAmp Community. All rights reserved. -#version 110 +#if __VERSION__ >= 130 + #define varying in + out vec4 mgl_FragData[2]; +#else + #define mgl_FragData gl_FragData +#endif uniform sampler2D gcs_TexUnit0; uniform sampler2D gcs_TexUnit1; @@ -12,5 +17,5 @@ void main (void) { vec2 rg = texture2D(gcs_TexUnit0, texCoord).rg + texture2D(gcs_TexUnit1, texCoord).rg; float b = frontColor.b - length(rg); - gl_FragData[0] = vec4( rg, b, 1.0 ); + mgl_FragData[0] = vec4( rg, b, 1.0 ); }
\ No newline at end of file diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-2.vp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-2.vp index 1b2c02328..89290b05a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-2.vp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/fbo-mrt-2.vp @@ -1,6 +1,9 @@ //Copyright 2010 JogAmp Community. All rights reserved. -#version 110 +#if __VERSION__ >= 130 + #define attribute in + #define varying out +#endif uniform mat4 gcu_PMVMatrix[2]; // P, Mv, and Mvi attribute vec4 gca_Vertices; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java index b38ae85e8..02f161cf6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java @@ -62,9 +62,6 @@ public class DemoGL2ES2ImmModeSink implements GLEventListener { pmvMatrix = new PMVMatrix(); } - static final String[] es2_prelude = { "#version 100\n", "precision mediump float;\n" }; - static final String gl2_prelude = "#version 110\n"; - public void init(GLAutoDrawable glad) { final GL2ES2 gl = glad.getGL().getGL2ES2(); @@ -76,19 +73,8 @@ public class DemoGL2ES2ImmModeSink implements GLEventListener { "../demos/es2/shader", "../demos/es2/shader/bin", "mgl_default_xxx", true); final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, DemoGL2ES2ImmModeSink.class, "../demos/es2/shader", "../demos/es2/shader/bin", "mgl_default_xxx", true); - - // Prelude shader code w/ GLSL profile specifics [ 1. pre-proc, 2. other ] - int fp0Pos; - if(gl.isGLES2()) { - vp0.insertShaderSource(0, 0, es2_prelude[0]); - fp0Pos = fp0.insertShaderSource(0, 0, es2_prelude[0]); - } else { - vp0.insertShaderSource(0, 0, gl2_prelude); - fp0Pos = fp0.insertShaderSource(0, 0, gl2_prelude); - } - if(gl.isGLES2()) { - fp0Pos = fp0.insertShaderSource(0, fp0Pos, es2_prelude[1]); - } + vp0.defaultShaderCustomization(gl, true, true); + fp0.defaultShaderCustomization(gl, true, true); sp = new ShaderProgram(); sp.add(gl, vp0, System.err); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES2NEWT.java index 48f1df757..165a3b8cf 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES2NEWT.java @@ -81,15 +81,13 @@ public class TestImmModeSinkES2NEWT extends UITestCase { @Test public void test05ImmSinkGL2ES2_VBOOff_Direct() throws InterruptedException { - final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2); - if(null == reqGLCaps) return; + final GLCapabilities reqGLCaps = new GLCapabilities( GLProfile.getMaxFixedFunc(true) ); doTest(reqGLCaps, new DemoGL2ES2ImmModeSink(false, false)); } @Test public void test05ImmSinkGL2ES2_VBOOff_ShaderState() throws InterruptedException { - final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2); - if(null == reqGLCaps) return; + final GLCapabilities reqGLCaps = new GLCapabilities( GLProfile.getMaxFixedFunc(true) ); doTest(reqGLCaps, new DemoGL2ES2ImmModeSink(false, true)); } |