diff options
Diffstat (limited to 'src/test/com/jogamp')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java | 961 |
1 files changed, 753 insertions, 208 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java index 9e875130a..3461ff650 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java @@ -36,6 +36,7 @@ import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLEventListener; +import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; import org.junit.Assert; @@ -72,7 +73,545 @@ public class TestGLProfile01NEWT extends UITestCase { } } - static void validate(final GLProfile glp) { + // + // GL4bc, GL4, GL3bc, GL3, GL2, GL2GL3, GL4ES3, GL3ES3, GL2ES2, GL2ES1, GLES3, GLES2, GLES1 + // + // Real: GL4bc, GL4, GL3bc, GL3, GL2, GLES3, GLES2, GLES1 + // Maps: GL2GL3, GL4ES3, GL3ES3, GL2ES2, GL2ES1 + // + + private static void validateGLProfileGL4bc(final GLProfile glp) { + Assert.assertTrue(glp.isGL4bc()); + Assert.assertTrue(glp.isGL4()); + Assert.assertTrue(glp.isGL3bc()); + Assert.assertTrue(glp.isGL3()); + Assert.assertTrue(glp.isGL2()); + Assert.assertFalse(glp.isGLES3()); + Assert.assertFalse(glp.isGLES2()); + Assert.assertFalse(glp.isGLES1()); + Assert.assertTrue(glp.isGL2GL3()); + Assert.assertTrue(glp.isGL4ES3()); + Assert.assertTrue(glp.isGL3ES3()); + Assert.assertTrue(glp.isGL2ES2()); + Assert.assertTrue(glp.isGL2ES1()); + } + private static void validateGL4bc(final GL gl) { + final GLContext ctx = gl.getContext(); + final boolean gles3CompatAvail = ctx.isGLES3Compatible(); + + Assert.assertTrue(gl.isGL4bc()); + Assert.assertTrue(gl.isGL4()); + Assert.assertTrue(gl.isGL3bc()); + Assert.assertTrue(gl.isGL3()); + Assert.assertTrue(gl.isGL2()); + Assert.assertTrue(gl.isGL2GL3()); + if( gles3CompatAvail ) { + Assert.assertTrue(gl.isGL4ES3()); + } else { + Assert.assertFalse(gl.isGL4ES3()); + } + Assert.assertTrue(gl.isGL3ES3()); + Assert.assertTrue(gl.isGL2ES2()); + Assert.assertTrue(gl.isGL2ES1()); + Assert.assertFalse(gl.isGLES3()); + Assert.assertFalse(gl.isGLES2()); + Assert.assertFalse(gl.isGLES1()); + + Assert.assertTrue(ctx.isGL4bc()); + Assert.assertTrue(ctx.isGL4()); + Assert.assertTrue(ctx.isGL3bc()); + Assert.assertTrue(ctx.isGL3()); + Assert.assertTrue(ctx.isGL2()); + Assert.assertTrue(ctx.isGL2GL3()); + if( gles3CompatAvail ) { + Assert.assertTrue(ctx.isGL4ES3()); + } else { + Assert.assertFalse(ctx.isGL4ES3()); + } + Assert.assertTrue(ctx.isGL3ES3()); + Assert.assertTrue(ctx.isGL2ES2()); + Assert.assertTrue(ctx.isGL2ES1()); + Assert.assertFalse(ctx.isGLES3()); + Assert.assertFalse(ctx.isGLES2()); + Assert.assertFalse(ctx.isGLES1()); + } + + private static void validateGLProfileGL4(final GLProfile glp) { + Assert.assertFalse(glp.isGL4bc()); + Assert.assertTrue(glp.isGL4()); + Assert.assertFalse(glp.isGL3bc()); + Assert.assertTrue(glp.isGL3()); + Assert.assertFalse(glp.isGL2()); + Assert.assertFalse(glp.isGLES3()); + Assert.assertFalse(glp.isGLES2()); + Assert.assertFalse(glp.isGLES1()); + Assert.assertTrue(glp.isGL2GL3()); + Assert.assertTrue(glp.isGL4ES3()); + Assert.assertTrue(glp.isGL3ES3()); + Assert.assertTrue(glp.isGL2ES2()); + Assert.assertFalse(glp.isGL2ES1()); + } + private static void validateGL4(final GL gl) { + final GLContext ctx = gl.getContext(); + final boolean gles3CompatAvail = ctx.isGLES3Compatible(); + + Assert.assertFalse(gl.isGL4bc()); + Assert.assertTrue(gl.isGL4()); + Assert.assertFalse(gl.isGL3bc()); + Assert.assertTrue(gl.isGL3()); + Assert.assertFalse(gl.isGL2()); + Assert.assertTrue(gl.isGL2GL3()); + if( gles3CompatAvail ) { + Assert.assertTrue(gl.isGL4ES3()); + } else { + Assert.assertFalse(gl.isGL4ES3()); + } + Assert.assertTrue(gl.isGL3ES3()); + Assert.assertTrue(gl.isGL2ES2()); + Assert.assertFalse(gl.isGL2ES1()); + Assert.assertFalse(gl.isGLES3()); + Assert.assertFalse(gl.isGLES2()); + Assert.assertFalse(gl.isGLES1()); + + Assert.assertFalse(ctx.isGL4bc()); + Assert.assertTrue(ctx.isGL4()); + Assert.assertFalse(ctx.isGL3bc()); + Assert.assertTrue(ctx.isGL3()); + Assert.assertFalse(ctx.isGL2()); + Assert.assertTrue(ctx.isGL2GL3()); + if( gles3CompatAvail ) { + Assert.assertTrue(ctx.isGL4ES3()); + } else { + Assert.assertFalse(ctx.isGL4ES3()); + } + Assert.assertTrue(ctx.isGL3ES3()); + Assert.assertTrue(ctx.isGL2ES2()); + Assert.assertFalse(ctx.isGL2ES1()); + Assert.assertFalse(ctx.isGLES3()); + Assert.assertFalse(ctx.isGLES2()); + Assert.assertFalse(ctx.isGLES1()); + } + + private static void validateGLProfileGL3bc(final GLProfile glp) { + Assert.assertFalse(glp.isGL4bc()); + Assert.assertFalse(glp.isGL4()); + Assert.assertTrue(glp.isGL3bc()); + Assert.assertTrue(glp.isGL3()); + Assert.assertTrue(glp.isGL2()); + Assert.assertFalse(glp.isGLES3()); + Assert.assertFalse(glp.isGLES2()); + Assert.assertFalse(glp.isGLES1()); + Assert.assertTrue(glp.isGL2GL3()); + Assert.assertFalse(glp.isGL4ES3()); + Assert.assertTrue(glp.isGL3ES3()); + Assert.assertTrue(glp.isGL2ES2()); + Assert.assertTrue(glp.isGL2ES1()); + } + private static void validateGL3bc(final GL gl) { + final GLContext ctx = gl.getContext(); + final boolean gles3CompatAvail = ctx.isGLES3Compatible(); + + Assert.assertFalse(gl.isGL4bc()); + Assert.assertFalse(gl.isGL4()); + Assert.assertTrue(gl.isGL3bc()); + Assert.assertTrue(gl.isGL3()); + Assert.assertTrue(gl.isGL2()); + Assert.assertTrue(gl.isGL2GL3()); + Assert.assertFalse(gl.isGL4ES3()); + Assert.assertTrue(gl.isGL3ES3()); + Assert.assertTrue(gl.isGL2ES2()); + Assert.assertTrue(gl.isGL2ES1()); + Assert.assertFalse(gl.isGLES3()); + Assert.assertFalse(gl.isGLES2()); + Assert.assertFalse(gl.isGLES1()); + + Assert.assertFalse(ctx.isGL4bc()); + Assert.assertFalse(ctx.isGL4()); + Assert.assertTrue(ctx.isGL3bc()); + Assert.assertTrue(ctx.isGL3()); + Assert.assertTrue(ctx.isGL2()); + Assert.assertTrue(ctx.isGL2GL3()); + Assert.assertFalse(ctx.isGL4ES3()); + Assert.assertTrue(ctx.isGL3ES3()); + Assert.assertFalse(gles3CompatAvail); + Assert.assertTrue(ctx.isGL2ES2()); + Assert.assertTrue(ctx.isGL2ES1()); + Assert.assertFalse(ctx.isGLES3()); + Assert.assertFalse(ctx.isGLES2()); + Assert.assertFalse(ctx.isGLES1()); + } + + private static void validateGLProfileGL3(final GLProfile glp) { + Assert.assertFalse(glp.isGL4bc()); + Assert.assertFalse(glp.isGL4()); + Assert.assertFalse(glp.isGL3bc()); + Assert.assertTrue(glp.isGL3()); + Assert.assertFalse(glp.isGL2()); + Assert.assertFalse(glp.isGLES3()); + Assert.assertFalse(glp.isGLES2()); + Assert.assertFalse(glp.isGLES1()); + Assert.assertTrue(glp.isGL2GL3()); + Assert.assertFalse(glp.isGL4ES3()); + Assert.assertTrue(glp.isGL3ES3()); + Assert.assertTrue(glp.isGL2ES2()); + Assert.assertFalse(glp.isGL2ES1()); + } + private static void validateGL3(final GL gl) { + final GLContext ctx = gl.getContext(); + final boolean gles3CompatAvail = ctx.isGLES3Compatible(); + + Assert.assertFalse(gl.isGL4bc()); + Assert.assertFalse(gl.isGL4()); + Assert.assertFalse(gl.isGL3bc()); + Assert.assertTrue(gl.isGL3()); + Assert.assertFalse(gl.isGL2()); + Assert.assertTrue(gl.isGL2GL3()); + Assert.assertFalse(gl.isGL4ES3()); + Assert.assertTrue(gl.isGL3ES3()); + Assert.assertTrue(gl.isGL2ES2()); + Assert.assertFalse(gl.isGL2ES1()); + Assert.assertFalse(gl.isGLES3()); + Assert.assertFalse(gl.isGLES2()); + Assert.assertFalse(gl.isGLES1()); + + Assert.assertFalse(ctx.isGL4bc()); + Assert.assertFalse(ctx.isGL4()); + Assert.assertFalse(ctx.isGL3bc()); + Assert.assertTrue(ctx.isGL3()); + Assert.assertFalse(ctx.isGL2()); + Assert.assertTrue(ctx.isGL2GL3()); + Assert.assertFalse(ctx.isGL4ES3()); + Assert.assertTrue(ctx.isGL3ES3()); + Assert.assertFalse(gles3CompatAvail); + Assert.assertTrue(ctx.isGL2ES2()); + Assert.assertFalse(ctx.isGL2ES1()); + Assert.assertFalse(ctx.isGLES3()); + Assert.assertFalse(ctx.isGLES2()); + Assert.assertFalse(ctx.isGLES1()); + } + + private static void validateGLProfileGL2(final GLProfile glp) { + Assert.assertFalse(glp.isGL4bc()); + Assert.assertFalse(glp.isGL4()); + Assert.assertFalse(glp.isGL3bc()); + Assert.assertFalse(glp.isGL3()); + Assert.assertTrue(glp.isGL2()); + Assert.assertFalse(glp.isGLES3()); + Assert.assertFalse(glp.isGLES2()); + Assert.assertFalse(glp.isGLES1()); + Assert.assertTrue(glp.isGL2GL3()); + Assert.assertFalse(glp.isGL4ES3()); + Assert.assertFalse(glp.isGL3ES3()); + Assert.assertTrue(glp.isGL2ES2()); + Assert.assertTrue(glp.isGL2ES1()); + } + private static void validateGL2(final GL gl) { + final GLContext ctx = gl.getContext(); + final boolean gles3CompatAvail = ctx.isGLES3Compatible(); + + Assert.assertFalse(gl.isGL4bc()); + Assert.assertFalse(gl.isGL4()); + Assert.assertFalse(gl.isGL3bc()); + Assert.assertFalse(gl.isGL3()); + Assert.assertTrue(gl.isGL2()); + Assert.assertTrue(gl.isGL2GL3()); + Assert.assertFalse(gl.isGL4ES3()); + Assert.assertFalse(gl.isGL3ES3()); + Assert.assertTrue(gl.isGL2ES2()); + Assert.assertTrue(gl.isGL2ES1()); + Assert.assertFalse(gl.isGLES3()); + Assert.assertFalse(gl.isGLES2()); + Assert.assertFalse(gl.isGLES1()); + + Assert.assertFalse(ctx.isGL4bc()); + Assert.assertFalse(ctx.isGL4()); + Assert.assertFalse(ctx.isGL3bc()); + Assert.assertFalse(ctx.isGL3()); + Assert.assertTrue(ctx.isGL2()); + Assert.assertTrue(ctx.isGL2GL3()); + Assert.assertFalse(ctx.isGL4ES3()); + Assert.assertFalse(ctx.isGL3ES3()); + Assert.assertFalse(gles3CompatAvail); + Assert.assertTrue(ctx.isGL2ES2()); + Assert.assertTrue(ctx.isGL2ES1()); + Assert.assertFalse(ctx.isGLES3()); + Assert.assertFalse(ctx.isGLES2()); + Assert.assertFalse(ctx.isGLES1()); + } + + private static void validateGLProfileGLES3(final GLProfile glp) { + Assert.assertFalse(glp.isGL4bc()); + Assert.assertFalse(glp.isGL4()); + Assert.assertFalse(glp.isGL3bc()); + Assert.assertFalse(glp.isGL3()); + Assert.assertFalse(glp.isGL2()); + Assert.assertTrue(glp.isGLES3()); + Assert.assertTrue(glp.isGLES2()); + Assert.assertFalse(glp.isGLES1()); + Assert.assertFalse(glp.isGL2GL3()); + Assert.assertTrue(glp.isGL4ES3()); + Assert.assertTrue(glp.isGL3ES3()); + Assert.assertTrue(glp.isGL2ES2()); + Assert.assertFalse(glp.isGL2ES1()); + } + private static void validateGLES3(final GL gl) { + final GLContext ctx = gl.getContext(); + final boolean gles3CompatAvail = ctx.isGLES3Compatible(); + + Assert.assertFalse(gl.isGL4bc()); + Assert.assertFalse(gl.isGL4()); + Assert.assertFalse(gl.isGL3bc()); + Assert.assertFalse(gl.isGL3()); + Assert.assertFalse(gl.isGL2()); + Assert.assertFalse(gl.isGL2GL3()); + Assert.assertTrue(gl.isGL4ES3()); + Assert.assertTrue(gl.isGL3ES3()); + Assert.assertTrue(gles3CompatAvail); + Assert.assertTrue(gl.isGL2ES2()); + Assert.assertFalse(gl.isGL2ES1()); + Assert.assertTrue(gl.isGLES3()); + Assert.assertTrue(gl.isGLES2()); + Assert.assertFalse(gl.isGLES1()); + + Assert.assertFalse(ctx.isGL4bc()); + Assert.assertFalse(ctx.isGL4()); + Assert.assertFalse(ctx.isGL3bc()); + Assert.assertFalse(ctx.isGL3()); + Assert.assertFalse(ctx.isGL2()); + Assert.assertFalse(ctx.isGL2GL3()); + Assert.assertTrue(ctx.isGL4ES3()); + Assert.assertTrue(ctx.isGL3ES3()); + Assert.assertTrue(gles3CompatAvail); + Assert.assertTrue(ctx.isGL2ES2()); + Assert.assertFalse(ctx.isGL2ES1()); + Assert.assertTrue(ctx.isGLES3()); + Assert.assertTrue(ctx.isGLES2()); + Assert.assertFalse(ctx.isGLES1()); + } + + private static void validateGLProfileGLES2(final GLProfile glp) { + Assert.assertFalse(glp.isGL4bc()); + Assert.assertFalse(glp.isGL4()); + Assert.assertFalse(glp.isGL3bc()); + Assert.assertFalse(glp.isGL3()); + Assert.assertFalse(glp.isGL2()); + Assert.assertFalse(glp.isGLES3()); + Assert.assertTrue(glp.isGLES2()); + Assert.assertFalse(glp.isGLES1()); + Assert.assertFalse(glp.isGL2GL3()); + Assert.assertFalse(glp.isGL4ES3()); + Assert.assertFalse(glp.isGL3ES3()); + Assert.assertTrue(glp.isGL2ES2()); + Assert.assertFalse(glp.isGL2ES1()); + } + private static void validateGLES2(final GL gl) { + final GLContext ctx = gl.getContext(); + final boolean gles3CompatAvail = ctx.isGLES3Compatible(); + + Assert.assertFalse(gl.isGL4bc()); + Assert.assertFalse(gl.isGL4()); + Assert.assertFalse(gl.isGL3bc()); + Assert.assertFalse(gl.isGL3()); + Assert.assertFalse(gl.isGL2()); + Assert.assertFalse(gl.isGL2GL3()); + Assert.assertFalse(gl.isGL4ES3()); + Assert.assertFalse(gl.isGL3ES3()); + Assert.assertFalse(gles3CompatAvail); + Assert.assertTrue(gl.isGL2ES2()); + Assert.assertFalse(gl.isGL2ES1()); + Assert.assertFalse(gl.isGLES3()); + Assert.assertTrue(gl.isGLES2()); + Assert.assertFalse(gl.isGLES1()); + + Assert.assertFalse(ctx.isGL4bc()); + Assert.assertFalse(ctx.isGL4()); + Assert.assertFalse(ctx.isGL3bc()); + Assert.assertFalse(ctx.isGL3()); + Assert.assertFalse(ctx.isGL2()); + Assert.assertFalse(ctx.isGL2GL3()); + Assert.assertFalse(ctx.isGL4ES3()); + Assert.assertFalse(ctx.isGL3ES3()); + Assert.assertFalse(gles3CompatAvail); + Assert.assertTrue(ctx.isGL2ES2()); + Assert.assertFalse(ctx.isGL2ES1()); + Assert.assertFalse(ctx.isGLES3()); + Assert.assertTrue(ctx.isGLES2()); + Assert.assertFalse(ctx.isGLES1()); + } + + private static void validateGLProfileGLES1(final GLProfile glp) { + Assert.assertFalse(glp.isGL4bc()); + Assert.assertFalse(glp.isGL4()); + Assert.assertFalse(glp.isGL3bc()); + Assert.assertFalse(glp.isGL3()); + Assert.assertFalse(glp.isGL2()); + Assert.assertFalse(glp.isGLES3()); + Assert.assertFalse(glp.isGLES2()); + Assert.assertTrue(glp.isGLES1()); + Assert.assertFalse(glp.isGL2GL3()); + Assert.assertFalse(glp.isGL4ES3()); + Assert.assertFalse(glp.isGL3ES3()); + Assert.assertFalse(glp.isGL2ES2()); + Assert.assertTrue(glp.isGL2ES1()); + } + private static void validateGLES1(final GL gl) { + final GLContext ctx = gl.getContext(); + final boolean gles3CompatAvail = ctx.isGLES3Compatible(); + + Assert.assertFalse(gl.isGL4bc()); + Assert.assertFalse(gl.isGL4()); + Assert.assertFalse(gl.isGL3bc()); + Assert.assertFalse(gl.isGL3()); + Assert.assertFalse(gl.isGL2()); + Assert.assertFalse(gl.isGL2GL3()); + Assert.assertFalse(gl.isGL4ES3()); + Assert.assertFalse(gl.isGL3ES3()); + Assert.assertFalse(gles3CompatAvail); + Assert.assertFalse(gl.isGL2ES2()); + Assert.assertTrue(gl.isGL2ES1()); + Assert.assertFalse(gl.isGLES3()); + Assert.assertFalse(gl.isGLES2()); + Assert.assertTrue(gl.isGLES1()); + + Assert.assertFalse(ctx.isGL4bc()); + Assert.assertFalse(ctx.isGL4()); + Assert.assertFalse(ctx.isGL3bc()); + Assert.assertFalse(ctx.isGL3()); + Assert.assertFalse(ctx.isGL2()); + Assert.assertFalse(ctx.isGL2GL3()); + Assert.assertFalse(ctx.isGL4ES3()); + Assert.assertFalse(ctx.isGL3ES3()); + Assert.assertFalse(gles3CompatAvail); + Assert.assertFalse(ctx.isGL2ES2()); + Assert.assertTrue(ctx.isGL2ES1()); + Assert.assertFalse(ctx.isGLES3()); + Assert.assertFalse(ctx.isGLES2()); + Assert.assertTrue(ctx.isGLES1()); + } + + private static void validateGLProfileGL2GL3(final GLProfile glp) { + if( glp.isGL4bc() ) { + validateGLProfileGL4bc(glp); + } else if(glp.isGL3bc()) { + validateGLProfileGL3bc(glp); + } else if(glp.isGL2()) { + validateGLProfileGL2(glp); + } else if(glp.isGL4()) { + validateGLProfileGL4(glp); + } else if(glp.isGL3()) { + validateGLProfileGL3(glp); + } else { + throw new GLException("GL2GL3 is neither GL4bc, GL3bc, GL2, GL4 nor GL3"); + } + } + private static void validateGL2GL3(final GL gl) { + if( gl.isGL4bc() ) { + validateGL4bc(gl); + } else if(gl.isGL3bc()) { + validateGL3bc(gl); + } else if(gl.isGL2()) { + validateGL2(gl); + } else if(gl.isGL4()) { + validateGL4(gl); + } else if(gl.isGL3()) { + validateGL3(gl); + } else { + throw new GLException("GL2GL3 is neither GL4bc, GL3bc, GL2, GL4 nor GL3"); + } + } + + private static void validateGLProfileGL4ES3(final GLProfile glp) { + if( glp.isGL4bc() ) { + validateGLProfileGL4bc(glp); + } else if( glp.isGL4() ) { + validateGLProfileGL4(glp); + } else if( glp.isGLES3() ) { + validateGLProfileGLES3(glp); + } else { + throw new GLException("GL4ES3 is neither GL4bc, GL4 nor GLES3"); + } + } + private static void validateGL4ES3(final GL gl) { + if( gl.isGL4bc() ) { + validateGL4bc(gl); + } else if( gl.isGL4() ) { + validateGL4(gl); + } else if( gl.isGLES3() ) { + validateGLES3(gl); + } else { + throw new GLException("GL4ES3 is neither GL4bc, GL4 nor GLES3"); + } + } + + private static void validateGLProfileGL2ES2(final GLProfile glp) { + if( glp.isGL4bc() ) { + validateGLProfileGL4bc(glp); + } else if(glp.isGL3bc()) { + validateGLProfileGL3bc(glp); + } else if(glp.isGL2()) { + validateGLProfileGL2(glp); + } else if(glp.isGL4()) { + validateGLProfileGL4(glp); + } else if(glp.isGL3()) { + validateGLProfileGL3(glp); + } else if(glp.isGLES3()) { + validateGLProfileGLES3(glp); + } else if(glp.isGLES2()) { + validateGLProfileGLES2(glp); + } else { + throw new GLException("GL2ES2 is neither GL4bc, GL3bc, GL2, GL4, GL3, GLES3 nor GLES2"); + } + } + private static void validateGL2ES2(final GL gl) { + if( gl.isGL4bc() ) { + validateGL4bc(gl); + } else if(gl.isGL3bc()) { + validateGL3bc(gl); + } else if(gl.isGL2()) { + validateGL2(gl); + } else if(gl.isGL4()) { + validateGL4(gl); + } else if(gl.isGL3()) { + validateGL3(gl); + } else if(gl.isGLES3()) { + validateGLES3(gl); + } else if(gl.isGLES2()) { + validateGLES2(gl); + } else { + throw new GLException("GL2ES2 is neither GL4bc, GL3bc, GL2, GL4, GL3, GLES3 nor GLES2"); + } + } + + private static void validateGLProfileGL2ES1(final GLProfile glp) { + if( glp.isGL4bc() ) { + validateGLProfileGL4bc(glp); + } else if(glp.isGL3bc()) { + validateGLProfileGL3bc(glp); + } else if(glp.isGL2()) { + validateGLProfileGL2(glp); + } else if(glp.isGLES1()) { + validateGLProfileGLES1(glp); + } else { + throw new GLException("GL2ES1 is neither GL4bc, GL3bc, GL2 nor GLES1"); + } + } + private static void validateGL2ES1(final GL gl) { + if( gl.isGL4bc() ) { + validateGL4bc(gl); + } else if(gl.isGL3bc()) { + validateGL3bc(gl); + } else if(gl.isGL2()) { + validateGL2(gl); + } else if(gl.isGLES1()) { + validateGLES1(gl); + } else { + throw new GLException("GL2ES1 is neither GL4bc, GL3bc, GL2 nor GLES1"); + } + } + + private static void validateOffline(final String requestedProfile, final GLProfile glp) { + System.err.println("GLProfile Mapping "+requestedProfile+" -> "+glp); + final boolean gles3CompatAvail = GLContext.isGLES3CompatibleAvailable(GLProfile.getDefaultDevice()); if( glp.getImplName().equals(GLProfile.GL4bc) ) { Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4bc)); @@ -130,163 +669,233 @@ public class TestGLProfile01NEWT extends UITestCase { Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1)); } if( glp.isGL4bc() ) { - Assert.assertTrue(glp.isGL4()); - Assert.assertTrue(glp.isGL3bc()); - Assert.assertTrue(glp.isGL3()); - Assert.assertTrue(glp.isGL2()); - Assert.assertTrue(glp.isGL2GL3()); - Assert.assertTrue(glp.isGL4ES3()); - Assert.assertTrue(glp.isGL3ES3()); - Assert.assertTrue(glp.isGL2ES1()); - Assert.assertTrue(glp.isGL2ES2()); + validateGLProfileGL4bc(glp); } else if(glp.isGL3bc()) { - Assert.assertTrue(glp.isGL3()); - Assert.assertTrue(glp.isGL2()); - Assert.assertTrue(glp.isGL2GL3()); - Assert.assertTrue(glp.isGL2ES1()); - Assert.assertTrue(glp.isGL2ES2()); + validateGLProfileGL3bc(glp); } else if(glp.isGL2()) { - Assert.assertTrue(glp.isGL2GL3()); - Assert.assertTrue(glp.isGL2ES1()); - Assert.assertTrue(glp.isGL2ES2()); + validateGLProfileGL2(glp); } else if(glp.isGL4()) { - Assert.assertTrue(glp.isGL3()); - Assert.assertTrue(glp.isGL2GL3()); - Assert.assertTrue(glp.isGL4ES3()); - Assert.assertTrue(glp.isGL3ES3()); - Assert.assertTrue(glp.isGL2ES2()); + validateGLProfileGL4(glp); } else if(glp.isGL3()) { - Assert.assertTrue(glp.isGL2GL3()); - Assert.assertTrue(glp.isGL3ES3()); - Assert.assertTrue(glp.isGL2ES2()); + validateGLProfileGL3(glp); } else if(glp.isGLES3()) { - Assert.assertTrue(glp.isGL4ES3()); - Assert.assertTrue(glp.isGL3ES3()); - Assert.assertTrue(glp.isGL2ES2()); + validateGLProfileGLES3(glp); } else if(glp.isGLES2()) { - Assert.assertTrue(glp.isGL2ES2()); + validateGLProfileGLES2(glp); } else if(glp.isGLES1()) { - Assert.assertTrue(glp.isGL2ES1()); + validateGLProfileGLES1(glp); } + + if( requestedProfile == GLProfile.GL4bc ) { + validateGLProfileGL4bc(glp); + } else if( requestedProfile == GLProfile.GL3bc ) { + validateGLProfileGL3bc(glp); + } else if( requestedProfile == GLProfile.GL2 ) { + validateGLProfileGL2(glp); + } else if( requestedProfile == GLProfile.GL4 ) { + validateGLProfileGL4(glp); + } else if( requestedProfile == GLProfile.GL3 ) { + validateGLProfileGL3(glp); + } else if( requestedProfile == GLProfile.GLES3 ) { + validateGLProfileGLES3(glp); + } else if( requestedProfile == GLProfile.GLES2 ) { + validateGLProfileGLES2(glp); + } else if( requestedProfile == GLProfile.GLES1 ) { + validateGLProfileGLES1(glp); + } else if( requestedProfile == GLProfile.GL2GL3 ) { + validateGLProfileGL2GL3(glp); + } else if( requestedProfile == GLProfile.GL4ES3 ) { + validateGLProfileGL4ES3(glp); + } else if( requestedProfile == GLProfile.GL2ES2 ) { + validateGLProfileGL2ES2(glp); + } else if( requestedProfile == GLProfile.GL2ES1 ) { + validateGLProfileGL2ES1(glp); + } + } - static void validate(final GL gl) { + static void validateOnline(final String requestedProfile, final GLProfile glpReq, final GL gl) { final GLContext ctx = gl.getContext(); - final boolean gles3CompatAvail = ctx.isGLES3Compatible(); + final GLProfile glp = gl.getGLProfile(); + System.err.println("GLContext Mapping "+requestedProfile+" -> "+glpReq+" -> "+glp+" -> "+ctx.getGLVersion()); + + System.err.println("GL impl. class "+gl.getClass().getName()); + if( gl.isGL4() ) { + Assert.assertNotNull( gl.getGL4() ); + System.err.println("GL Mapping "+glp+" -> GL4"); + } if( gl.isGL4bc() ) { - Assert.assertTrue(gl.isGL4()); - Assert.assertTrue(gl.isGL3bc()); - Assert.assertTrue(gl.isGL3()); - Assert.assertTrue(gl.isGL2()); - Assert.assertTrue(gl.isGL2GL3()); - if( gles3CompatAvail ) { - Assert.assertTrue(gl.isGL4ES3()); - } else { - Assert.assertFalse(gl.isGL4ES3()); - } - Assert.assertTrue(gl.isGL3ES3()); - Assert.assertTrue(gl.isGL2ES1()); - Assert.assertTrue(gl.isGL2ES2()); + Assert.assertNotNull( gl.getGL4bc() ); + System.err.println("GL Mapping "+glp+" -> GL4bc"); + } + if( gl.isGL3() ) { + Assert.assertNotNull( gl.getGL3() ); + System.err.println("GL Mapping "+glp+" -> GL3"); + } + if( gl.isGL3bc() ) { + Assert.assertNotNull( gl.getGL3bc() ); + System.err.println("GL Mapping "+glp+" -> GL3bc"); + } + if( gl.isGL2() ) { + Assert.assertNotNull( gl.getGL2() ); + System.err.println("GL Mapping "+glp+" -> GL2"); + } + if( gl.isGLES3() ) { + Assert.assertNotNull( gl.getGLES3() ); + System.err.println("GL Mapping "+glp+" -> GLES3"); + } + if( gl.isGLES2() ) { + Assert.assertNotNull( gl.getGLES2() ); + System.err.println("GL Mapping "+glp+" -> GLES2"); + } + if( gl.isGLES1() ) { + Assert.assertNotNull( gl.getGLES1() ); + System.err.println("GL Mapping "+glp+" -> GLES1"); + } + if( gl.isGL4ES3() ) { + Assert.assertNotNull( gl.getGL4ES3() ); + System.err.println("GL Mapping "+glp+" -> GL4ES3"); + } + if( gl.isGL3ES3() ) { + Assert.assertNotNull( gl.getGL3ES3() ); + System.err.println("GL Mapping "+glp+" -> GL3ES3"); + } + if( gl.isGL2GL3() ) { + Assert.assertNotNull( gl.getGL2GL3() ); + System.err.println("GL Mapping "+glp+" -> GL2GL3"); + } + if( gl.isGL2ES2() ) { + Assert.assertNotNull( gl.getGL2ES2() ); + System.err.println("GL Mapping "+glp+" -> GL2ES2"); + } + if( gl.isGL2ES1() ) { + Assert.assertNotNull( gl.getGL2ES1() ); + System.err.println("GL Mapping "+glp+" -> GL2ES1"); + } + + if( gl.isGL4bc() ) { + validateGL4bc(gl); } else if(gl.isGL3bc()) { - Assert.assertTrue(gl.isGL3()); - Assert.assertTrue(gl.isGL2()); - Assert.assertTrue(gl.isGL2GL3()); - Assert.assertTrue(gl.isGL2ES1()); - Assert.assertTrue(gl.isGL2ES2()); + validateGL3bc(gl); } else if(gl.isGL2()) { - Assert.assertTrue(gl.isGL2GL3()); - Assert.assertTrue(gl.isGL2ES1()); - Assert.assertTrue(gl.isGL2ES2()); + validateGL2(gl); } else if(gl.isGL4()) { - Assert.assertTrue(gl.isGL3()); - Assert.assertTrue(gl.isGL2GL3()); - if( gles3CompatAvail ) { - Assert.assertTrue(gl.isGL4ES3()); - } else { - Assert.assertFalse(gl.isGL4ES3()); - } - Assert.assertTrue(gl.isGL3ES3()); - Assert.assertTrue(gl.isGL2ES2()); + validateGL4(gl); } else if(gl.isGL3()) { - Assert.assertTrue(gl.isGL2GL3()); - Assert.assertTrue(gl.isGL3ES3()); - Assert.assertTrue(gl.isGL2ES2()); + validateGL3(gl); } else if(gl.isGLES3()) { - if( gles3CompatAvail ) { - Assert.assertTrue(gl.isGL4ES3()); - } else { - Assert.assertFalse(gl.isGL4ES3()); - } - Assert.assertTrue(gl.isGL3ES3()); - Assert.assertTrue(gl.isGL2ES2()); + validateGLES3(gl); } else if(gl.isGLES2()) { - Assert.assertTrue(gl.isGL2ES2()); + validateGLES2(gl); } else if(gl.isGLES1()) { - Assert.assertTrue(gl.isGL2ES1()); + validateGLES1(gl); } - if( ctx.isGL4bc() ) { - Assert.assertTrue(ctx.isGL4()); - Assert.assertTrue(ctx.isGL3bc()); - Assert.assertTrue(ctx.isGL3()); - Assert.assertTrue(ctx.isGL2()); - Assert.assertTrue(ctx.isGL2GL3()); - if( gles3CompatAvail ) { - Assert.assertTrue(ctx.isGL4ES3()); + if( requestedProfile == GLProfile.GL4bc ) { + validateGL4bc(gl); + } else if( requestedProfile == GLProfile.GL3bc ) { + if( gl.isGL4bc() ) { + validateGL4bc(gl); + } else if( gl.isGL3bc() ) { + validateGL3bc(gl); } else { - Assert.assertFalse(ctx.isGL4ES3()); + throw new GLException("GL3bc is neither GL4bc nor GL3bc"); } - Assert.assertTrue(ctx.isGL3ES3()); - Assert.assertTrue(ctx.isGL2ES1()); - Assert.assertTrue(ctx.isGL2ES2()); - } else if(ctx.isGL3bc()) { - Assert.assertTrue(ctx.isGL3()); - Assert.assertTrue(ctx.isGL2()); - Assert.assertTrue(ctx.isGL2GL3()); - Assert.assertTrue(ctx.isGL2ES1()); - Assert.assertTrue(ctx.isGL2ES2()); - } else if(ctx.isGL2()) { - Assert.assertTrue(ctx.isGL2GL3()); - Assert.assertTrue(ctx.isGL2ES1()); - Assert.assertTrue(ctx.isGL2ES2()); - } else if(ctx.isGL4()) { - Assert.assertTrue(ctx.isGL3()); - Assert.assertTrue(ctx.isGL2GL3()); - if( gles3CompatAvail ) { - Assert.assertTrue(ctx.isGL4ES3()); + } else if( requestedProfile == GLProfile.GL2 ) { + if( gl.isGL4bc() ) { + validateGL4bc(gl); + } else if( gl.isGL3bc() ) { + validateGL3bc(gl); + } else if( gl.isGL2() ) { + validateGL2(gl); } else { - Assert.assertFalse(ctx.isGL4ES3()); + throw new GLException("GL2 is neither GL4bc, GL3bc, GL2"); } - Assert.assertTrue(ctx.isGL3ES3()); - Assert.assertTrue(ctx.isGL2ES2()); - } else if(ctx.isGL3()) { - Assert.assertTrue(ctx.isGL2GL3()); - Assert.assertTrue(ctx.isGL3ES3()); - Assert.assertTrue(ctx.isGL2ES2()); - } else if(ctx.isGLES3()) { - if( gles3CompatAvail ) { - Assert.assertTrue(ctx.isGL4ES3()); + } else if( requestedProfile == GLProfile.GL4 ) { + if( gl.isGL4bc() ) { + validateGL4bc(gl); + } else if( gl.isGL4() ) { + validateGL4(gl); + } else { + throw new GLException("GL4 is neither GL4bc, nor GL4"); + } + } else if( requestedProfile == GLProfile.GL3 ) { + if( gl.isGL4bc() ) { + validateGL4bc(gl); + } else if( gl.isGL3bc() ) { + validateGL3bc(gl); + } else if( gl.isGL4() ) { + validateGL4(gl); + } else if( gl.isGL3() ) { + validateGL3(gl); } else { - Assert.assertFalse(ctx.isGL4ES3()); + throw new GLException("GL3 is neither GL4bc, GL3bc, GL4 nor GL3"); } - Assert.assertTrue(ctx.isGL3ES3()); - Assert.assertTrue(ctx.isGL2ES2()); - } else if(ctx.isGLES2()) { - Assert.assertTrue(ctx.isGL2ES2()); - } else if(ctx.isGLES1()) { - Assert.assertTrue(ctx.isGL2ES1()); + } else if( requestedProfile == GLProfile.GLES3 ) { + validateGLES3(gl); + } else if( requestedProfile == GLProfile.GLES2 ) { + if( gl.isGLES3() ) { + validateGLES3(gl); + } else if( gl.isGLES2() ) { + validateGLES2(gl); + } else { + throw new GLException("GLES2 is neither GLES3 nor GLES2"); + } + } else if( requestedProfile == GLProfile.GLES1 ) { + validateGLES1(gl); + } else if( requestedProfile == GLProfile.GL2GL3 ) { + validateGL2GL3(gl); + } else if( requestedProfile == GLProfile.GL4ES3 ) { + validateGL4ES3(gl); + } else if( requestedProfile == GLProfile.GL2ES2 ) { + validateGL2ES2(gl); + } else if( requestedProfile == GLProfile.GL2ES1 ) { + validateGL2ES1(gl); } } + void validateOnline(final String requestedProfile, final GLProfile glp) throws InterruptedException { + final GLCapabilities caps = new GLCapabilities(glp); + final GLWindow glWindow = GLWindow.create(caps); + Assert.assertNotNull(glWindow); + glWindow.setTitle(getSimpleTestName(".")); + + glWindow.addGLEventListener(new GLEventListener() { + + public void init(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); + System.err.println(JoglVersion.getGLStrings(gl, null, false)); + + validateOnline(requestedProfile, glp, gl); + } + + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { + } + + public void display(final GLAutoDrawable drawable) { + } + + public void dispose(final GLAutoDrawable drawable) { + } + }); + + glWindow.setSize(128, 128); + glWindow.setVisible(true); + + glWindow.display(); + Thread.sleep(100); + glWindow.destroy(); + } + @Test public void test01GLProfileDefault() throws InterruptedException { System.out.println("GLProfile "+GLProfile.glAvailabilityToString()); System.out.println("GLProfile.getDefaultDevice(): "+GLProfile.getDefaultDevice()); final GLProfile glp = GLProfile.getDefault(); System.out.println("GLProfile.getDefault(): "+glp); - validate(glp); - dumpVersion(glp); + validateOffline("default", glp); + validateOnline("default", glp); } @Test @@ -294,8 +903,8 @@ public class TestGLProfile01NEWT extends UITestCase { // Assuming at least one programmable profile is available final GLProfile glp = GLProfile.getMaxProgrammable(true); System.out.println("GLProfile.getMaxProgrammable(): "+glp); - validate(glp); - dumpVersion(glp); + validateOffline("maxProgrammable", glp); + validateOnline("maxProgrammable", glp); } @Test @@ -303,8 +912,8 @@ public class TestGLProfile01NEWT extends UITestCase { // Assuming at least one fixed function profile is available final GLProfile glp = GLProfile.getMaxFixedFunc(true); System.out.println("GLProfile.getMaxFixedFunc(): "+glp); - validate(glp); - dumpVersion(glp); + validateOffline("maxFixedFunc", glp); + validateOnline("maxFixedFunc", glp); } @Test @@ -314,9 +923,8 @@ public class TestGLProfile01NEWT extends UITestCase { return; } final GLProfile glp = GLProfile.getGL2ES1(); - System.out.println("GLProfile GL2ES1: "+glp); - validate(glp); - dumpVersion(glp); + validateOffline(GLProfile.GL2ES1, glp); + validateOnline(GLProfile.GL2ES1, glp); } @Test @@ -326,9 +934,8 @@ public class TestGLProfile01NEWT extends UITestCase { return; } final GLProfile glp = GLProfile.getGL2ES2(); - System.out.println("GLProfile GL2ES2: "+glp); - validate(glp); - dumpVersion(glp); + validateOffline(GLProfile.GL2ES2, glp); + validateOnline(GLProfile.GL2ES2, glp); } @Test @@ -338,16 +945,26 @@ public class TestGLProfile01NEWT extends UITestCase { return; } final GLProfile glp = GLProfile.getGL4ES3(); - System.out.println("GLProfile GL4ES3: "+glp); - validate(glp); - dumpVersion(glp); + validateOffline(GLProfile.GL4ES3, glp); + validateOnline(GLProfile.GL4ES3, glp); + } + + @Test + public void test07GLProfileGL2GL3() throws InterruptedException { + if(!GLProfile.isAvailable(GLProfile.GL2GL3)) { + System.out.println("GLProfile GL2GL3 n/a"); + return; + } + final GLProfile glp = GLProfile.getGL2GL3(); + validateOffline(GLProfile.GL2GL3, glp); + validateOnline(GLProfile.GL2GL3, glp); } void testSpecificProfile(final String glps) throws InterruptedException { if(GLProfile.isAvailable(glps)) { final GLProfile glp = GLProfile.get(glps); - validate(glp); - dumpVersion(glp); + validateOffline(glps, glp); + validateOnline(glps, glp); } else { System.err.println("Profile "+glps+" n/a"); } @@ -393,78 +1010,6 @@ public class TestGLProfile01NEWT extends UITestCase { testSpecificProfile(GLProfile.GLES3); } - protected void dumpVersion(final GLProfile glp) throws InterruptedException { - final GLCapabilities caps = new GLCapabilities(glp); - final GLWindow glWindow = GLWindow.create(caps); - Assert.assertNotNull(glWindow); - glWindow.setTitle("TestGLProfile01NEWT"); - - glWindow.addGLEventListener(new GLEventListener() { - - public void init(final GLAutoDrawable drawable) { - final GL gl = drawable.getGL(); - System.err.println(JoglVersion.getGLStrings(gl, null, true)); - - validate(gl); - - final GLProfile glp = gl.getGLProfile(); - System.err.println("GL impl. class "+gl.getClass().getName()); - if( gl.isGL4() ) { - Assert.assertNotNull( gl.getGL4() ); - System.err.println("GL Mapping "+glp+" -> GL4"); - } - if( gl.isGL4bc() ) { - Assert.assertNotNull( gl.getGL4bc() ); - System.err.println("GL Mapping "+glp+" -> GL4bc"); - } - if( gl.isGL3() ) { - Assert.assertNotNull( gl.getGL3() ); - System.err.println("GL Mapping "+glp+" -> GL3"); - } - if( gl.isGL3bc() ) { - Assert.assertNotNull( gl.getGL3bc() ); - System.err.println("GL Mapping "+glp+" -> GL3bc"); - } - if( gl.isGLES3() ) { - Assert.assertNotNull( gl.getGLES3() ); - System.err.println("GL Mapping "+glp+" -> GLES3"); - } - if( gl.isGLES2() ) { - Assert.assertNotNull( gl.getGLES2() ); - System.err.println("GL Mapping "+glp+" -> GLES2"); - } - if( gl.isGL4ES3() ) { - Assert.assertNotNull( gl.getGL4ES3() ); - System.err.println("GL Mapping "+glp+" -> GL4ES3"); - } - if( gl.isGL2ES2() ) { - Assert.assertNotNull( gl.getGL2ES2() ); - System.err.println("GL Mapping "+glp+" -> GL2ES2"); - } - if( gl.isGL2ES1() ) { - Assert.assertNotNull( gl.getGL2ES1() ); - System.err.println("GL Mapping "+glp+" -> GL2ES1"); - } - } - - public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { - } - - public void display(final GLAutoDrawable drawable) { - } - - public void dispose(final GLAutoDrawable drawable) { - } - }); - - glWindow.setSize(128, 128); - glWindow.setVisible(true); - - glWindow.display(); - Thread.sleep(100); - glWindow.destroy(); - } - public static void main(final String args[]) throws IOException { final String tstname = TestGLProfile01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); |