diff options
author | Sven Gothel <[email protected]> | 2015-08-30 04:55:12 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-08-30 04:55:12 +0200 |
commit | 2db11ad80582af8715071b47b5331b79001d511c (patch) | |
tree | b21c5a684068b20b8e7bcaea890182b4f9e06f10 | |
parent | 3ac457a3a9074a70bf428bb6a5674b8f70d268b1 (diff) |
Bug 1207 - GLDebugMessageHandler: Support GL_KHR_debug for Desktop and ES profile
GL_KHR_debug <https://www.opengl.org/registry/specs/KHR/debug.txt>
GL_KHR_debug shall be favorized before
- GL_ARB_debug_output
- GL_AMD_debug_output
Allow GL_KHR_debug for GL2GL3 and GL2ES2 profiles,
i.e. including ES profiles: GLES2, GLES3.
GL_ARB_debug_output and GL_AMD_debug_output
are only allowed for desktop GL2GL3 profiles.
-rw-r--r-- | make/config/jogl/gl-es1.cfg | 3 | ||||
-rw-r--r-- | make/config/jogl/gl-es3-impl.cfg | 3 | ||||
-rw-r--r-- | make/config/jogl/gl-gl4bc.cfg | 2 | ||||
-rw-r--r-- | make/scripts/tests.sh | 5 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/GLExtensions.java | 1 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 14 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java | 82 | ||||
-rw-r--r-- | src/jogl/native/GLDebugMessageHandler.c | 7 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java | 85 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java | 65 |
10 files changed, 210 insertions, 57 deletions
diff --git a/make/config/jogl/gl-es1.cfg b/make/config/jogl/gl-es1.cfg index 6ce59770e..f72ad54ea 100644 --- a/make/config/jogl/gl-es1.cfg +++ b/make/config/jogl/gl-es1.cfg @@ -39,6 +39,9 @@ ProcAddressTableClassName GLES1ProcAddressTable GetProcAddressTableExpr _pat # GetProcAddressTableExpr ((GLES1ProcAddressTable)_context.getGLProcAddressTable()) +# Manual implement glDebugMessageCallback* using the proc address resolver +ForceProcAddressGen glDebugMessageCallbackKHR + # Force all of the methods to be emitted using dynamic linking so we # don't need to link against any emulation library on the desktop or # depend on the presence of an import library for a particular device diff --git a/make/config/jogl/gl-es3-impl.cfg b/make/config/jogl/gl-es3-impl.cfg index 01ef034f6..c6b9b45f1 100644 --- a/make/config/jogl/gl-es3-impl.cfg +++ b/make/config/jogl/gl-es3-impl.cfg @@ -44,6 +44,9 @@ ProcAddressTableClassName GLES3ProcAddressTable GetProcAddressTableExpr _pat # GetProcAddressTableExpr ((GLES3ProcAddressTable)_context.getGLProcAddressTable()) +# Manual implement glDebugMessageCallback* using the proc address resolver +ForceProcAddressGen glDebugMessageCallbackKHR + # Force all of the methods to be emitted using dynamic linking so we # don't need to link against any emulation library on the desktop or # depend on the presence of an import library for a particular device diff --git a/make/config/jogl/gl-gl4bc.cfg b/make/config/jogl/gl-gl4bc.cfg index e3e706688..60cc0fc48 100644 --- a/make/config/jogl/gl-gl4bc.cfg +++ b/make/config/jogl/gl-gl4bc.cfg @@ -180,7 +180,7 @@ MethodJavadoc glMapNamedBufferRangeEXT * </p> DelegateImplementation glUnmapNamedBuffer glUnmapNamedBufferDelegate DelegateImplementation glUnmapNamedEXTBuffer glUnmapNamedEXTBufferDelegate -# Manuall implement glDebugMessageCallback* using the proc address resolver +# Manual implement glDebugMessageCallback* using the proc address resolver ForceProcAddressGen glDebugMessageCallback ForceProcAddressGen glDebugMessageCallbackAMD diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 740f3c483..3242bfff1 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -181,6 +181,7 @@ function jrun() { #D_ARGS="-Djogl.debug.GLEventListenerState" #D_ARGS="-Djogl.debug.GLDebugMessageHandler" #D_ARGS="-Djogl.debug.GLDebugMessageHandler -Djogl.debug.DebugGL" + #D_ARGS="-Djogl.debug.GLDebugMessageHandler -Djogl.debug.DebugGL -Djogl.debug.GLContext" #D_ARGS="-Djogl.debug.GLDebugMessageHandler -Djogl.debug.TraceGL -Djogl.debug.DebugGL -Djogl.debug.GLSLCode -Djogl.debug.GLSLState" #D_ARGS="-Djogl.debug.GLDebugMessageHandler -Djogl.debug.DebugGL -Djogl.debug.TraceGL" #D_ARGS="-Djogl.1thread=false -Djogl.debug.Threading" @@ -513,7 +514,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestInitConcurrent02NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextSurfaceLockNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLDebug00NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLDebug01NEWT $* +testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLDebug01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLException01NEWT $* @@ -570,7 +571,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryGLnBitmapCapsNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryES2OffscrnCapsNEWT $* -testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryGLProfileDeviceNEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryGLProfileDeviceNEWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT $* diff --git a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java index 1bf8071ea..dc1a4e010 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java +++ b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java @@ -36,6 +36,7 @@ public class GLExtensions { public static final String VERSION_1_5 = "GL_VERSION_1_5"; public static final String VERSION_2_0 = "GL_VERSION_2_0"; + public static final String GL_KHR_debug = "GL_KHR_debug"; public static final String ARB_debug_output = "GL_ARB_debug_output"; public static final String AMD_debug_output = "GL_AMD_debug_output"; diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 45cfc6bcc..6e904d0ed 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -693,7 +693,7 @@ public abstract class GLContextImpl extends GLContext { // throws an GLException if not // FIXME: drawable.getGLProfile().verifyEquality(gl.getGLProfile()); - glDebugHandler.init( isGL2GL3() && isGLDebugEnabled() ); + glDebugHandler.init( isGLDebugEnabled() ); if(DEBUG_GL) { setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, gl, null) ); @@ -2820,8 +2820,8 @@ public abstract class GLContextImpl extends GLContext { @Override public final void glDebugMessageControl(final int source, final int type, final int severity, final int count, final IntBuffer ids, final boolean enabled) { - if(glDebugHandler.isExtensionARB()) { - gl.getGL2GL3().glDebugMessageControl(source, type, severity, count, ids, enabled); + if(glDebugHandler.isExtensionKHRARB()) { + gl.getGL2ES2().glDebugMessageControl(source, type, severity, count, ids, enabled); } else if(glDebugHandler.isExtensionAMD()) { gl.getGL2GL3().glDebugMessageEnableAMD(GLDebugMessage.translateARB2AMDCategory(source, type), severity, count, ids, enabled); } @@ -2829,8 +2829,8 @@ public abstract class GLContextImpl extends GLContext { @Override public final void glDebugMessageControl(final int source, final int type, final int severity, final int count, final int[] ids, final int ids_offset, final boolean enabled) { - if(glDebugHandler.isExtensionARB()) { - gl.getGL2GL3().glDebugMessageControl(source, type, severity, count, ids, ids_offset, enabled); + if(glDebugHandler.isExtensionKHRARB()) { + gl.getGL2ES2().glDebugMessageControl(source, type, severity, count, ids, ids_offset, enabled); } else if(glDebugHandler.isExtensionAMD()) { gl.getGL2GL3().glDebugMessageEnableAMD(GLDebugMessage.translateARB2AMDCategory(source, type), severity, count, ids, ids_offset, enabled); } @@ -2839,8 +2839,8 @@ public abstract class GLContextImpl extends GLContext { @Override public final void glDebugMessageInsert(final int source, final int type, final int id, final int severity, final String buf) { final int len = (null != buf) ? buf.length() : 0; - if(glDebugHandler.isExtensionARB()) { - gl.getGL2GL3().glDebugMessageInsert(source, type, id, severity, len, buf); + if(glDebugHandler.isExtensionKHRARB()) { + gl.getGL2ES2().glDebugMessageInsert(source, type, id, severity, len, buf); } else if(glDebugHandler.isExtensionAMD()) { gl.getGL2GL3().glDebugMessageInsertAMD(GLDebugMessage.translateARB2AMDCategory(source, type), severity, id, len, buf); } diff --git a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java index cd31d02fd..fb4529da4 100644 --- a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java +++ b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java @@ -61,8 +61,9 @@ import com.jogamp.opengl.GLExtensions; public class GLDebugMessageHandler { private static final boolean DEBUG = Debug.debug("GLDebugMessageHandler"); - private static final int EXT_ARB = 1; - private static final int EXT_AMD = 2; + private static final int EXT_KHR = 1; + private static final int EXT_ARB = 2; + private static final int EXT_AMD = 3; static { if ( !initIDs0() ) { @@ -75,6 +76,7 @@ public class GLDebugMessageHandler { // licefycle: init - EOL private String extName; + private String extSuffix; private int extType; private long glDebugMessageCallbackProcAddress; private boolean extAvailable; @@ -92,6 +94,7 @@ public class GLDebugMessageHandler { this.listenerImpl = new ListenerSyncedImplStub<GLDebugListener>(); this.glDebugMessageCallbackProcAddress = 0; this.extName = null; + this.extSuffix = null; this.extType = 0; this.extAvailable = false; this.handle = 0; @@ -143,43 +146,68 @@ public class GLDebugMessageHandler { } return; } - if( ctx.isExtensionAvailable(GLExtensions.ARB_debug_output) ) { + if( ctx.isExtensionAvailable(GLExtensions.GL_KHR_debug) ) { + extName = GLExtensions.GL_KHR_debug; + extSuffix = ctx.isGLES() ? "KHR" : ""; // See SPEC! + extType = EXT_KHR; + } else if( ctx.isExtensionAvailable(GLExtensions.ARB_debug_output) ) { extName = GLExtensions.ARB_debug_output; + extSuffix = "ARB"; extType = EXT_ARB; } else if( ctx.isExtensionAvailable(GLExtensions.AMD_debug_output) ) { extName = GLExtensions.AMD_debug_output; + extSuffix = "AMD"; extType = EXT_AMD; } - if(DEBUG) { - System.err.println("GLDebugMessageHandler: Using extension: <"+extName+">"); + + // Validate GL Profile, just to be sure + switch(extType) { + case EXT_KHR: + if( !ctx.isGL2ES2() ) { + if(DEBUG) { + System.err.println("Non GL2ES2 context not supported, has "+ctx.getGLVersion()); + } + extType = 0; + } + break; + case EXT_ARB: + // fall through intended + case EXT_AMD: + if( !ctx.isGL2GL3() ) { + if(DEBUG) { + System.err.println("Non GL2GL3 context not supported, has "+ctx.getGLVersion()); + } + extType = 0; + } + break; } if(0 == extType) { + extName = null; + extSuffix = null; if(DEBUG) { System.err.println("GLDebugMessageHandler: No extension available! "+ctx.getGLVersion()); System.err.println("GL_EXTENSIONS "+ctx.getGLExtensionCount()); System.err.println(ctx.getGLExtensionsString()); } return; + } else if(DEBUG) { + System.err.println("GLDebugMessageHandler: Using extension: <"+extName+"> with suffix <"+extSuffix+">"); } final ProcAddressTable procAddressTable = ctx.getGLProcAddressTable(); - if( !ctx.isGLES1() && !ctx.isGLES2() ) { - switch(extType) { - case EXT_ARB: - glDebugMessageCallbackProcAddress = getAddressFor(procAddressTable, "glDebugMessageCallbackARB"); - break; - case EXT_AMD: - glDebugMessageCallbackProcAddress = getAddressFor(procAddressTable, "glDebugMessageCallbackAMD"); - break; - } - } else { - glDebugMessageCallbackProcAddress = 0; - if(DEBUG) { - System.err.println("Non desktop context not supported"); - } + switch(extType) { + case EXT_KHR: + glDebugMessageCallbackProcAddress = getAddressFor(procAddressTable, "glDebugMessageCallback"+extSuffix); + break; + case EXT_ARB: + glDebugMessageCallbackProcAddress = getAddressFor(procAddressTable, "glDebugMessageCallback"+extSuffix); + break; + case EXT_AMD: + glDebugMessageCallbackProcAddress = getAddressFor(procAddressTable, "glDebugMessageCallback"+extSuffix); + break; } - extAvailable = 0 < extType && null != extName && 0 != glDebugMessageCallbackProcAddress; + extAvailable = 0 < extType && null != extName && null != extSuffix && 0 != glDebugMessageCallbackProcAddress; if(DEBUG) { System.err.println("GLDebugMessageHandler: extAvailable: "+extAvailable+", glDebugMessageCallback* : 0x"+Long.toHexString(glDebugMessageCallbackProcAddress)); @@ -203,12 +231,20 @@ public class GLDebugMessageHandler { return extName; } + public final boolean isExtensionKHRARB() { + return EXT_KHR == extType || EXT_ARB == extType; + } + + public final boolean isExtensionKHR() { + return EXT_KHR == extType; + } + public final boolean isExtensionARB() { - return extName == GLExtensions.ARB_debug_output; + return EXT_ARB == extType; } public final boolean isExtensionAMD() { - return extName == GLExtensions.AMD_debug_output; + return EXT_AMD == extType; } /** @@ -226,7 +262,7 @@ public class GLDebugMessageHandler { } } private final void setSynchronousImpl() { - if(isExtensionARB()) { + if(isExtensionKHRARB()) { if(synchronous) { ctx.getGL().glEnable(GL2ES2.GL_DEBUG_OUTPUT_SYNCHRONOUS); } else { diff --git a/src/jogl/native/GLDebugMessageHandler.c b/src/jogl/native/GLDebugMessageHandler.c index 5c18b94b1..e524df9bf 100644 --- a/src/jogl/native/GLDebugMessageHandler.c +++ b/src/jogl/native/GLDebugMessageHandler.c @@ -17,6 +17,7 @@ #define DBG_PRINT(...) #endif +// Note: 'ARB' is also used for 'KHR'! static jmethodID glDebugMessageARB = NULL; // int source, int type, int id, int severity, String msg static jmethodID glDebugMessageAMD = NULL; // int id, int category, int severity, String msg @@ -120,7 +121,8 @@ JNIEXPORT jlong JNICALL Java_jogamp_opengl_GLDebugMessageHandler_register0 handle->extType = extType; DBG_PRINT("GLDebugMessageHandler.register0: jobject %p, extType %d\n", (void*)handle->obj, handle->extType); - if(jogamp_opengl_GLDebugMessageHandler_EXT_ARB == extType) { + if(jogamp_opengl_GLDebugMessageHandler_EXT_KHR == extType || + jogamp_opengl_GLDebugMessageHandler_EXT_ARB == extType) { _local_PFNGLDEBUGMESSAGECALLBACKARBPROC ptr_glDebugMessageCallbackARB; ptr_glDebugMessageCallbackARB = (_local_PFNGLDEBUGMESSAGECALLBACKARBPROC) (intptr_t) procAddress; ptr_glDebugMessageCallbackARB((_local_GLDEBUGPROCARB)GLDebugMessageARBCallback, handle); @@ -151,7 +153,8 @@ JNIEXPORT void JNICALL Java_jogamp_opengl_GLDebugMessageHandler_unregister0 JoglCommon_throwNewRuntimeException(env, "wrong handle (obj doesn't match)"); } - if(jogamp_opengl_GLDebugMessageHandler_EXT_ARB == handle->extType) { + if(jogamp_opengl_GLDebugMessageHandler_EXT_KHR == handle->extType || + jogamp_opengl_GLDebugMessageHandler_EXT_ARB == handle->extType) { _local_PFNGLDEBUGMESSAGECALLBACKARBPROC ptr_glDebugMessageCallbackARB; ptr_glDebugMessageCallbackARB = (_local_PFNGLDEBUGMESSAGECALLBACKARBPROC) (intptr_t) procAddress; ptr_glDebugMessageCallbackARB((_local_GLDEBUGPROCARB)NULL, NULL); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java index dcee114e5..8319a1c22 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java @@ -32,7 +32,6 @@ import java.io.IOException; import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2ES2; -import com.jogamp.opengl.GL2GL3; import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLContext; import com.jogamp.opengl.GLDebugListener; @@ -58,6 +57,14 @@ public class TestGLDebug00NEWT extends UITestCase { static String dbgTstMsg0 = "Hello World"; static int dbgTstId0 = 42; + static GLProfile getGLProfile(final String profile) { + if( !GLProfile.isAvailable(profile) ) { + System.err.println("Profile "+profile+" n/a"); + return null; + } + return GLProfile.get(profile); + } + public static class WindowContext { public final Window window; public final GLContext context; @@ -115,9 +122,7 @@ public class TestGLDebug00NEWT extends UITestCase { } - void test01GLDebug01EnableDisable(final boolean enable) throws InterruptedException { - final GLProfile glp = GLProfile.getDefault(); - + void testX1GLDebugEnableDisable(final GLProfile glp, final boolean enable) throws InterruptedException { final WindowContext winctx = createWindow(glp, enable); final String glDebugExt = winctx.context.getGLDebugMessageExtension(); System.err.println("glDebug extension: "+glDebugExt); @@ -131,19 +136,42 @@ public class TestGLDebug00NEWT extends UITestCase { } @Test - public void test01GLDebugDisabled() throws InterruptedException { - test01GLDebug01EnableDisable(false); + public void test01GL2GL3DebugDisabled() throws InterruptedException { + final GLProfile glp = getGLProfile(GLProfile.GL2GL3); + if( null == glp ) { + return; + } + testX1GLDebugEnableDisable(glp, false); } @Test - public void test01GLDebugEnabled() throws InterruptedException { - test01GLDebug01EnableDisable(true); + public void test02GL2GL3DebugEnabled() throws InterruptedException { + final GLProfile glp = getGLProfile(GLProfile.GL2GL3); + if( null == glp ) { + return; + } + testX1GLDebugEnableDisable(glp, true); } @Test - public void test02GLDebugError() throws InterruptedException { - final GLProfile glp = GLProfile.getDefault(); + public void test11GLES2DebugDisabled() throws InterruptedException { + final GLProfile glp = getGLProfile(GLProfile.GLES2); + if( null == glp ) { + return; + } + testX1GLDebugEnableDisable(glp, false); + } + + @Test + public void test12GLES2DebugEnabled() throws InterruptedException { + final GLProfile glp = getGLProfile(GLProfile.GLES2); + if( null == glp ) { + return; + } + testX1GLDebugEnableDisable(glp, true); + } + void testX2GLDebugError(final GLProfile glp) throws InterruptedException { final WindowContext winctx = createWindow(glp, true); final MyGLDebugListener myGLDebugListener = new MyGLDebugListener( @@ -164,8 +192,24 @@ public class TestGLDebug00NEWT extends UITestCase { } @Test - public void test03GLDebugInsert() throws InterruptedException { - final GLProfile glp = GLProfile.getDefault(); + public void test03GL2GL3DebugError() throws InterruptedException { + final GLProfile glp = getGLProfile(GLProfile.GL2GL3); + if( null == glp ) { + return; + } + testX2GLDebugError(glp); + } + + @Test + public void test13GLES2DebugError() throws InterruptedException { + final GLProfile glp = getGLProfile(GLProfile.GLES2); + if( null == glp ) { + return; + } + testX2GLDebugError(glp); + } + + void testX3GLDebugInsert(final GLProfile glp) throws InterruptedException { final WindowContext winctx = createWindow(glp, true); final MyGLDebugListener myGLDebugListener = new MyGLDebugListener(dbgTstMsg0, dbgTstId0); winctx.context.addGLDebugListener(myGLDebugListener); @@ -184,6 +228,23 @@ public class TestGLDebug00NEWT extends UITestCase { destroyWindow(winctx); } + @Test + public void test04GL2GL3DebugInsert() throws InterruptedException { + final GLProfile glp = getGLProfile(GLProfile.GL2GL3); + if( null == glp ) { + return; + } + testX3GLDebugInsert(glp); + } + + @Test + public void test14GLES2DebugInsert() throws InterruptedException { + final GLProfile glp = getGLProfile(GLProfile.GLES2); + if( null == glp ) { + return; + } + testX3GLDebugInsert(glp); + } public static void main(final String args[]) throws IOException { final String tstname = TestGLDebug00NEWT.class.getName(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java index 66733209c..43d207a0d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java @@ -31,7 +31,6 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; import com.jogamp.opengl.GL2ES2; -import com.jogamp.opengl.GL2GL3; import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLContext; @@ -54,6 +53,14 @@ public class TestGLDebug01NEWT extends UITestCase { static String dbgTstMsg0 = "Hello World"; static int dbgTstId0 = 42; + static GLProfile getGLProfile(final String profile) { + if( !GLProfile.isAvailable(profile) ) { + System.err.println("Profile "+profile+" n/a"); + return null; + } + return GLProfile.get(profile); + } + GLWindow createWindow(final GLProfile glp, final boolean debugGL) { final GLCapabilities caps = new GLCapabilities(glp); // @@ -76,9 +83,7 @@ public class TestGLDebug01NEWT extends UITestCase { } - void test01GLDebug01EnableDisable(final boolean enable, final String dbgTstMsg, final int dbgTstId) throws InterruptedException { - final GLProfile glp = GLProfile.getDefault(); - + void testX1GLDebugEnableDisable(final GLProfile glp, final boolean enable, final String dbgTstMsg, final int dbgTstId) throws InterruptedException { final GLWindow window = createWindow(glp, enable); final GLContext ctx = window.getContext(); final MyGLDebugListener myGLDebugListener = new MyGLDebugListener(dbgTstMsg, dbgTstId); @@ -109,19 +114,42 @@ public class TestGLDebug01NEWT extends UITestCase { } @Test - public void test01GLDebug01Disabled() throws InterruptedException { - test01GLDebug01EnableDisable(false, null, -1); + public void test01GL2GL3DebugDisabled() throws InterruptedException { + final GLProfile glp = getGLProfile(GLProfile.GL2GL3); + if( null == glp ) { + return; + } + testX1GLDebugEnableDisable(glp, false, null, -1); } @Test - public void test01GLDebug01Enabled() throws InterruptedException { - test01GLDebug01EnableDisable(true, dbgTstMsg0, dbgTstId0); + public void test02GL2GL3DebugEnabled() throws InterruptedException { + final GLProfile glp = getGLProfile(GLProfile.GL2GL3); + if( null == glp ) { + return; + } + testX1GLDebugEnableDisable(glp, true, dbgTstMsg0, dbgTstId0); } @Test - public void test02GLDebug01Error() throws InterruptedException { - final GLProfile glp = GLProfile.getDefault(); + public void test11GLES2DebugDisabled() throws InterruptedException { + final GLProfile glp = getGLProfile(GLProfile.GLES2); + if( null == glp ) { + return; + } + testX1GLDebugEnableDisable(glp, false, null, -1); + } + @Test + public void test12GLES2DebugEnabled() throws InterruptedException { + final GLProfile glp = getGLProfile(GLProfile.GLES2); + if( null == glp ) { + return; + } + testX1GLDebugEnableDisable(glp, true, dbgTstMsg0, dbgTstId0); + } + + void testX3GLDebugError(final GLProfile glp) throws InterruptedException { final GLWindow window = createWindow(glp, true); final MyGLDebugListener myGLDebugListener = new MyGLDebugListener( @@ -144,6 +172,23 @@ public class TestGLDebug01NEWT extends UITestCase { destroyWindow(window); } + @Test + public void test03GL2GL3DebugError() throws InterruptedException { + final GLProfile glp = getGLProfile(GLProfile.GL2GL3); + if( null == glp ) { + return; + } + testX3GLDebugError(glp); + } + + @Test + public void test13GLES2DebugError() throws InterruptedException { + final GLProfile glp = getGLProfile(GLProfile.GLES2); + if( null == glp ) { + return; + } + testX3GLDebugError(glp); + } public static void main(final String args[]) throws IOException { final String tstname = TestGLDebug01NEWT.class.getName(); |