diff options
author | Sven Gothel <[email protected]> | 2015-03-26 16:33:55 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-03-26 16:33:55 +0100 |
commit | e0ed09f8e2df570a9542f606a133c8fde074cbfe (patch) | |
tree | bf6df61a15771999212290b369a88620ddc8040d | |
parent | 590b5bed36622933f452caf1db18b4dd16a75669 (diff) |
Bug 1150 - Fix GLContextImpl.createImpl(..) NoARBCreateContext and '!ARB GL >= 3.1' issues
This fix solves the described issues below.
Test cases added for onscreen and offscreen drawables,
the latter includes Window's bitmap special case.
GLContextImpl.createImpl(..): Fix NoARBCreateContext and '!ARB GL >= 3.1' issues:
=================================================================================
GLContextImpl.createImpl(..) implementation of X11GLXContext and WindowsWGLContext
wrongly handles the case of NoARBCreateContext.
Here the !ARB created context shall allow GL >= 3.1,
since ARB context creation is disabled and 'no mix' can occur.
The latter was already intended due to failure criteris 'createContextARBTried'
in:
if( glCaps.getGLProfile().isGL3() && createContextARBTried ) {
failure("createImpl ctx !ARB but ARB is used, profile > GL2 requested");
}
Further, WindowsWGLContext treats glCaps.isBitmap()
within the 'createContextARBTried=true' case, but it shall never
tried using the ARB context creation method.
This even lead to the issue of creating a 1.1 context,
but having the ProcAddressTable being still on the GL > 2 cached table.
This is due to 'setGLFunctionAvailability(..)'.
Ensure 'setGLFunctionAvailability(..)' is functional
====================================================
Caller shall either throws an exception if method returns false
or issues a state reset.
In case 'setGLFunctionAvailability(..)' throws an exception itself,
the states are no issue.
16 files changed, 1340 insertions, 933 deletions
diff --git a/make/scripts/make.jogl.all.win32.bat b/make/scripts/make.jogl.all.win32.bat index cda04474a..0f1198c10 100755 --- a/make/scripts/make.jogl.all.win32.bat +++ b/make/scripts/make.jogl.all.win32.bat @@ -1,7 +1,7 @@ set THISDIR="C:\JOGL"
-set J2RE_HOME=c:\jre1.8.0_20_x32
-set JAVA_HOME=c:\jdk1.8.0_20_x32
+set J2RE_HOME=c:\jre1.8.0_25_x32
+set JAVA_HOME=c:\jdk1.8.0_25_x32
set ANT_PATH=C:\apache-ant-1.9.4
set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%PATH%
diff --git a/make/scripts/make.jogl.all.win64.bat b/make/scripts/make.jogl.all.win64.bat index 0e2acbc93..6b20a710d 100755 --- a/make/scripts/make.jogl.all.win64.bat +++ b/make/scripts/make.jogl.all.win64.bat @@ -1,7 +1,7 @@ set THISDIR="C:\JOGL"
-set J2RE_HOME=c:\jre1.8.0_20_x64
-set JAVA_HOME=c:\jdk1.8.0_20_x64
+set J2RE_HOME=c:\jre1.8.0_25_x64
+set JAVA_HOME=c:\jdk1.8.0_25_x64
set ANT_PATH=C:\apache-ant-1.9.4
set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw64\bin;%PATH%
diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat index 97c580539..7f25e33b8 100755 --- a/make/scripts/tests-win.bat +++ b/make/scripts/tests-win.bat @@ -77,6 +77,10 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDraw REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile02NEWT %* +REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile02NEWTNoARBCtx $* +REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile03NEWTOffscreen $* +scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile04NEWTOffscreenNoARBCtx $* + REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch02AWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch01NEWT %* REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch11NEWT %* @@ -217,4 +221,4 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewt REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestBug461FBOSupersamplingSwingAWT REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.glsl.TestRulerNEWT01 -scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.stereo.StereoDemo01 %* +REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.stereo.StereoDemo01 %* diff --git a/make/scripts/tests-x64-dbg.bat b/make/scripts/tests-x64-dbg.bat index bcc546efe..fdd7d50e9 100755 --- a/make/scripts/tests-x64-dbg.bat +++ b/make/scripts/tests-x64-dbg.bat @@ -35,6 +35,7 @@ REM set D_ARGS="-Djogl.disable.opengles" REM set D_ARGS="-Djogl.disable.openglcore"
REM set D_ARGS="-Djogl.disable.openglarbcontext"
REM set D_ARGS="-Dnativewindow.debug.GDIUtil" "-Dnativewindow.debug.RegisteredClass"
+set D_ARGS="-Djogl.debug.GLContext"
REM set D_ARGS="-Djogl.debug.GLContext" "-Djogl.debug.FBObject"
REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.EGLDrawableFactory.DontQuery"
REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.EGLDrawableFactory.QueryNativeTK"
@@ -67,7 +68,7 @@ REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.GLJPanel" "-Djogl.debug.Til REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.GLJPanel" "-Djogl.debug.TileRenderer"
REM set D_ARGS="-Djogl.debug.GLContext" "-Djogl.debug.GLJPanel"
REM set D_ARGS="-Djogl.gljpanel.noverticalflip"
-set D_ARGS="-Dnewt.debug=all"
+REM set D_ARGS="-Dnewt.debug=all"
REM set D_ARGS="-Dnewt.debug.Window"
REM set D_ARGS="-Dnewt.debug.Window.KeyEvent"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Window.KeyEvent" "-Dnewt.debug.EDT"
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 620796960..2d137a0b3 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -123,7 +123,7 @@ function jrun() { #D_ARGS="-Djogl.disable.opengldesktop" #D_ARGS="-Djogl.disable.opengles" #D_ARGS="-Djogl.disable.openglcore" - #D_ARGS="-Djogl.disable.openglarbcontext" + #D_ARGS="-Djogl.debug=all -Djogl.disable.openglarbcontext" #D_ARGS="-Djogl.debug.DebugGL -Dnewt.debug.Window" #D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.FBObject" #D_ARGS="-Djogl.debug.FBObject -Djogl.debug.TraceGL -Djogl.debug.GLBufferStateTracker" @@ -406,12 +406,15 @@ function testawtswt() { #testawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLCanvasAWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile02NEWTNoARBCtx $* +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile03NEWTOffscreen $* +testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile04NEWTOffscreenNoARBCtx $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestVersionSemanticsNOUI $* # # Stereo # -testnoawt com.jogamp.opengl.test.junit.jogl.stereo.StereoDemo01 $* +#testnoawt com.jogamp.opengl.test.junit.jogl.stereo.StereoDemo01 $* # # HiDPI diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index c56dc74da..401ea29c6 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -851,18 +851,25 @@ public abstract class GLContextImpl extends GLContext { } /** - * Platform dependent entry point for context creation.<br> - * - * This method is called from {@link #makeCurrentWithinLock()} .. {@link #makeCurrent()} .<br> - * + * Platform dependent entry point for context creation. + * <p> + * This method is called from {@link #makeCurrentWithinLock()} .. {@link #makeCurrent()} . + * </p> + * <p> * The implementation shall verify this context with a - * <code>MakeContextCurrent</code> call.<br> - * - * The implementation <b>must</b> leave the context current.<br> - * + * <code>MakeContextCurrent</code> call. + * </p> + * <p> + * The implementation <b>must</b> leave the context current. + * </p> + * <p> + * Non fatal context creation failure via return {@code false} + * is currently implemented for: {@code MacOSXCGLContext}. + * </p> * @param sharedWithHandle the shared context handle or 0 - * @return true if successful, or false - * @throws GLException + * @return {@code true} if successful. Method returns {@code false} if the context creation failed non fatally, + * hence it may be created at a later time. Otherwise method throws {@link GLException}. + * @throws GLException if method fatally fails creating the context and no attempt shall be made at a later time. */ protected abstract boolean createImpl(long sharedWithHandle) throws GLException ; @@ -908,6 +915,15 @@ public abstract class GLContextImpl extends GLContext { */ protected abstract void destroyContextARBImpl(long context); + protected final boolean isCreateContextARBAvail(final AbstractGraphicsDevice device) { + return !GLProfile.disableOpenGLARBContext && + !GLRendererQuirks.existStickyDeviceQuirk(device, GLRendererQuirks.NoARBCreateContext); + } + protected final String getCreateContextARBAvailStr(final AbstractGraphicsDevice device) { + final boolean noARBCreateContext = GLRendererQuirks.existStickyDeviceQuirk(device, GLRendererQuirks.NoARBCreateContext); + return "disabled "+GLProfile.disableOpenGLARBContext+", quirk "+noARBCreateContext; + } + /** * Platform independent part of using the <code>ARB_create_context</code> * mechanism to create a context.<br> @@ -929,25 +945,12 @@ public abstract class GLContextImpl extends GLContext { */ protected final long createContextARB(final long share, final boolean direct) { - if( GLProfile.disableOpenGLARBContext || - GLRendererQuirks.existStickyDeviceQuirk(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(), - GLRendererQuirks.NoARBCreateContext) ) { - if( DEBUG ) { - System.err.println(getThreadName() + ": createContextARB: Disabled "+ - "- property disableOpenGLARBContext "+ GLProfile.disableOpenGLARBContext + - ", quirk NoARBCreateContext "+GLRendererQuirks.existStickyDeviceQuirk(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(), - GLRendererQuirks.NoARBCreateContext)); - } - return 0; - } final AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration(); final AbstractGraphicsDevice device = config.getScreen().getDevice(); - if (DEBUG) { System.err.println(getThreadName() + ": createContextARB: mappedVersionsAvailableSet("+device.getConnection()+"): "+ GLContext.getAvailableGLVersionsSet(device)); } - final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); final GLProfile glp = glCaps.getGLProfile(); @@ -1016,7 +1019,7 @@ public abstract class GLContextImpl extends GLContext { System.err.println("Quirk Triggerd: "+GLRendererQuirks.toString(GLRendererQuirks.GL4NeedsGL3Request)+": cause: OS "+Platform.getOSType()+", OS Version "+Platform.getOSVersionNumber()); } } - resetStates(false); // clean this context states, since creation was temporary + resetStates(false); // clean the context states, since creation was temporary } } } @@ -1468,9 +1471,14 @@ public abstract class GLContextImpl extends GLContext { * the cache of which GL functions are available for calling through this * context. See {@link #isFunctionAvailable(String)} for more information on * the definition of "available". - * <br> + * <p> * All ProcaddressTables are being determined and cached, the GL version is being set * and the extension cache is determined as well. + * </p> + * <p> + * It is the callers responsibility to issue {@link #resetStates(boolean)} + * in case this method returns {@code false} or throws a {@link GLException}. + * </p> * * @param force force the setting, even if is already being set. * This might be useful if you change the OpenGL implementation. @@ -1489,13 +1497,16 @@ public abstract class GLContextImpl extends GLContext { * @return returns <code>true</code> if successful, otherwise <code>false</code>.<br> * If <code>strictMatch</code> is <code>false</code> method shall always return <code>true</code> or throw an exception. * If <code>false</code> is returned, no data has been cached or mapped, i.e. ProcAddressTable, Extensions, Version, etc. + * @throws GLException in case of an unexpected OpenGL related issue, e.g. missing expected GL function pointer. * @see #setContextVersion * @see com.jogamp.opengl.GLContext#CTX_OPTION_ANY * @see com.jogamp.opengl.GLContext#CTX_PROFILE_COMPAT * @see com.jogamp.opengl.GLContext#CTX_IMPL_ES2_COMPAT */ protected final boolean setGLFunctionAvailability(final boolean force, int major, int minor, int ctxProfileBits, - final boolean strictMatch, final boolean withinGLVersionsMapping) { + final boolean strictMatch, final boolean withinGLVersionsMapping) + throws GLException + { if( null != this.gl && null != glProcAddressTable && !force ) { return true; // already done and not forced } @@ -1695,7 +1706,7 @@ public abstract class GLContextImpl extends GLContext { synchronized(mappedContextTypeObjectLock) { table = mappedGLProcAddress.get( contextFQN ); if(null != table && !verifyInstance(glp, "ProcAddressTable", table)) { - throw new InternalError("GLContext GL ProcAddressTable mapped key("+contextFQN+" - " + GLContext.getGLVersion(major, minor, ctxProfileBits, null)+ + throw new GLException("GLContext GL ProcAddressTable mapped key("+contextFQN+" - " + GLContext.getGLVersion(major, minor, ctxProfileBits, null)+ ") -> "+ table.getClass().getName()+" not matching "+glp.getGLImplBaseClassName()); } } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index 9d7ad64f9..b6a05aeeb 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -51,6 +51,7 @@ import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLDrawableImpl; import jogamp.opengl.egl.EGLExtImpl; import jogamp.opengl.egl.EGLExtProcAddressTable; +import jogamp.opengl.windows.wgl.WindowsWGLContext; import com.jogamp.common.ExceptionUtils; import com.jogamp.common.nio.Buffers; @@ -310,16 +311,25 @@ public class EGLContext extends GLContextImpl { final AbstractGraphicsDevice device = config.getScreen().getDevice(); final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); final GLProfile glp = glCaps.getGLProfile(); - - contextHandle = createContextARB(shareWithHandle, true); - if (DEBUG) { - if( 0 != contextHandle ) { - System.err.println(getThreadName() + ": EGLContext.createImpl: OK (ARB) on eglDevice "+device+ - ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError())); - } else { - System.err.println(getThreadName() + ": EGLContext.createImpl: NOT OK (ARB) - creation failed on eglDevice "+device+ - ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError())); + final boolean createContextARBAvailable = isCreateContextARBAvail(device); + if(DEBUG) { + System.err.println(getThreadName() + ": EGLContext.createImpl: START "+glCaps+", share "+toHexString(shareWithHandle)); + System.err.println(getThreadName() + ": Use ARB[avail["+getCreateContextARBAvailStr(device)+ + "] -> "+createContextARBAvailable+"]]"); + } + if( createContextARBAvailable ) { + contextHandle = createContextARB(shareWithHandle, true); + if (DEBUG) { + if( 0 != contextHandle ) { + System.err.println(getThreadName() + ": createImpl: OK (ARB) on eglDevice "+device+ + ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError())); + } else { + System.err.println(getThreadName() + ": createImpl: NOT OK (ARB) - creation failed on eglDevice "+device+ + ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError())); + } } + } else { + contextHandle = 0; } if( 0 == contextHandle ) { if( !glp.isGLES() ) { @@ -339,18 +349,18 @@ public class EGLContext extends GLContextImpl { EGL.eglMakeCurrent(drawable.getNativeSurface().getDisplayHandle(), EGL.EGL_NO_SURFACE, EGL.EGL_NO_SURFACE, EGL.EGL_NO_CONTEXT); EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), contextHandle); contextHandle = 0; - throw new InternalError("setGLFunctionAvailability !strictMatch failed"); + throw new GLException("setGLFunctionAvailability !strictMatch failed"); } } if (DEBUG) { - System.err.println(getThreadName() + ": EGLContext.createImpl: Created OpenGL context 0x" + + System.err.println(getThreadName() + ": createImpl: Created OpenGL context 0x" + Long.toHexString(contextHandle) + ",\n\twrite surface 0x" + Long.toHexString(drawable.getHandle()) + ",\n\tread surface 0x" + Long.toHexString(drawableRead.getHandle())+ ",\n\t"+this+ ",\n\tsharing with 0x" + Long.toHexString(shareWithHandle)); } - return 0 != contextHandle; + return true; } @Override diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 3c22e612f..d4fc0b005 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -289,8 +289,15 @@ public class MacOSXCGLContext extends GLContextImpl @Override protected boolean createImpl(final long shareWithHandle) throws GLException { final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration(); - final GLCapabilitiesImmutable capabilitiesChosen = (GLCapabilitiesImmutable) config.getChosenCapabilities(); - final GLProfile glp = capabilitiesChosen.getGLProfile(); + final AbstractGraphicsDevice device = config.getScreen().getDevice(); + final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); + final GLProfile glp = glCaps.getGLProfile(); + final boolean createContextARBAvailable = isCreateContextARBAvail(device); + if(DEBUG) { + System.err.println(getThreadName() + ": MacOSXCGLContext.createImpl: START "+glCaps+", share "+toHexString(shareWithHandle)); + System.err.println(getThreadName() + ": Use ARB[avail["+getCreateContextARBAvailStr(device)+ + "] -> "+createContextARBAvailable+"]]"); + } if( glp.isGLES() || ( glp.isGL3() && !isLionOrLater ) || ( glp.isGL4() && !isMavericksOrLater ) ) { throw new GLException("OpenGL profile not supported on MacOSX "+Platform.getOSVersionNumber()+": "+glp); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java index 966a4dcf5..a8269ad5c 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java @@ -50,7 +50,6 @@ import com.jogamp.nativewindow.NativeSurface; import com.jogamp.opengl.GLContext; import com.jogamp.opengl.GLException; import com.jogamp.opengl.GLCapabilitiesImmutable; - import com.jogamp.common.nio.Buffers; import com.jogamp.gluegen.runtime.ProcAddressTable; import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver; @@ -278,7 +277,7 @@ public class WindowsWGLContext extends GLContextImpl { * called by {@link #makeCurrentImpl()}. */ @Override - protected boolean createImpl(long shareWithHandle) { + protected boolean createImpl(long shareWithHandle) throws GLException { final AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration(); final AbstractGraphicsDevice device = config.getScreen().getDevice(); final WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory)drawable.getFactoryImpl(); @@ -287,14 +286,18 @@ public class WindowsWGLContext extends GLContextImpl { isGLReadDrawableAvailable(); // trigger setup wglGLReadDrawableAvailable - if (DEBUG) { - System.err.println(getThreadName() + ": createImpl: START "+glCaps+", share "+toHexString(shareWithHandle)); + final boolean createContextARBAvailable = isCreateContextARBAvail(device) && !glCaps.isBitmap(); + final boolean sharedCreatedWithARB = null != sharedContext && sharedContext.isCreatedWithARBMethod(); + if(DEBUG) { + System.err.println(getThreadName() + ": WindowsWGLContext.createImpl: START "+glCaps+", share "+toHexString(shareWithHandle)); + System.err.println(getThreadName() + ": Use ARB[avail["+getCreateContextARBAvailStr(device)+ + "], bitmap "+glCaps.isBitmap()+" -> "+createContextARBAvailable+ + "], shared "+sharedCreatedWithARB+"]"); } - boolean createContextARBTried = false; - // utilize the shared context's GLXExt in case it was using the ARB method and it already exists ; exclude BITMAP - if( null != sharedContext && sharedContext.isCreatedWithARBMethod() && !glCaps.isBitmap() ) { + // utilize the shared context's GLXExt in case it was using the ARB method and it already exists + if( createContextARBAvailable && sharedCreatedWithARB ) { if ( sharedContext.getRendererQuirks().exist( GLRendererQuirks.NeedCurrCtx4ARBCreateContext ) ) { if(GLContext.CONTEXT_NOT_CURRENT == sharedContext.makeCurrent()) { throw new GLException("Could not make Shared Context current: "+sharedContext); @@ -327,34 +330,27 @@ public class WindowsWGLContext extends GLContextImpl { if( !setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, null == sharedContext /* withinGLVersionsMapping */) ) { // use GL_VERSION WGL.wglMakeCurrent(0, 0); // release temp context WGL.wglDeleteContext(temp_ctx); - throw new InternalError("setGLFunctionAvailability !strictMatch failed"); + throw new GLException("setGLFunctionAvailability !strictMatch failed"); } WGL.wglMakeCurrent(0, 0); // release temp context - if( !createContextARBTried ) { + if( createContextARBAvailable && !createContextARBTried ) { // is*Available calls are valid since setGLFunctionAvailability(..) was called - final boolean isProcCreateContextAttribsARBAvailable; - final boolean isExtARBCreateContextAvailable; - if( !glCaps.isBitmap() ) { // exclude ARB if BITMAP - isProcCreateContextAttribsARBAvailable = isFunctionAvailable("wglCreateContextAttribsARB"); - isExtARBCreateContextAvailable = isExtensionAvailable("WGL_ARB_create_context"); - } else { - isProcCreateContextAttribsARBAvailable = false; - isExtARBCreateContextAvailable = false; - } + final boolean isProcCreateContextAttribsARBAvailable = isFunctionAvailable("wglCreateContextAttribsARB"); + final boolean isExtARBCreateContextAvailable = isExtensionAvailable("WGL_ARB_create_context"); if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable ) { // initial ARB context creation contextHandle = createContextARB(shareWithHandle, true); createContextARBTried=true; if (DEBUG) { if( 0 != contextHandle ) { - System.err.println(getThreadName() + ": createContextImpl: OK (ARB, initial) share "+toHexString(shareWithHandle)); + System.err.println(getThreadName() + ": createImpl: OK (ARB, initial) share "+toHexString(shareWithHandle)); } else { - System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - creation failed - share "+toHexString(shareWithHandle)); + System.err.println(getThreadName() + ": createImpl: NOT OK (ARB, initial) - creation failed - share "+toHexString(shareWithHandle)); } } } else if (DEBUG) { - System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+toHexString(shareWithHandle)+ + System.err.println(getThreadName() + ": createImpl: NOT OK (ARB, initial) - extension not available - share "+toHexString(shareWithHandle)+ ", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+ ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable); } @@ -378,10 +374,11 @@ public class WindowsWGLContext extends GLContextImpl { // otherwise context of similar profile but different creation method may not be share-able. WGL.wglMakeCurrent(0, 0); WGL.wglDeleteContext(temp_ctx); - throw new GLException(getThreadName()+": WindowsWGLContex.createContextImpl ctx !ARB but ARB is used, profile > GL2 requested (OpenGL >= 3.1). Requested: "+glCaps.getGLProfile()+", current: "+getGLVersion()); + throw new GLException(getThreadName()+": createImpl ctx !ARB but ARB is used, profile > GL2 requested (OpenGL >= 3.1). Requested: "+glCaps.getGLProfile()+", current: "+getGLVersion()); } if(DEBUG) { - System.err.println("WindowsWGLContext.createContext ARB not used, fall back to !ARB context "+getGLVersion()); + System.err.println(getThreadName()+": createImpl ARB not used[avail "+createContextARBAvailable+ + ", tried "+createContextARBTried+"], fall back to !ARB context "+getGLVersion()); } // continue with temp context diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java index fab5895e8..274d16ddd 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java @@ -113,7 +113,7 @@ public class X11ExternalGLXContext extends X11GLXContext { } @Override - protected boolean createImpl(final long shareWithHandle) { + protected boolean createImpl(final long shareWithHandle) throws GLException { return true; } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java index 4665dc17c..63b0b35c0 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java @@ -298,7 +298,7 @@ public class X11GLXContext extends GLContextImpl { } @Override - protected boolean createImpl(final long shareWithHandle) { + protected boolean createImpl(final long shareWithHandle) throws GLException { boolean direct = true; // try direct always isDirect = false; // fall back @@ -314,6 +314,14 @@ public class X11GLXContext extends GLContextImpl { final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); final GLProfile glp = glCaps.getGLProfile(); + final boolean createContextARBAvailable = isCreateContextARBAvail(device) && config.hasFBConfig(); + final boolean sharedCreatedWithARB = null != sharedContext && sharedContext.isCreatedWithARBMethod(); + if(DEBUG) { + System.err.println(getThreadName() + ": X11GLXContext.createImpl: START "+glCaps+", share "+toHexString(shareWithHandle)); + System.err.println(getThreadName() + ": Use ARB[avail["+getCreateContextARBAvailStr(device)+ + "], fbCfg "+config.hasFBConfig()+" -> "+createContextARBAvailable+ + "], shared "+sharedCreatedWithARB+"]"); + } if( !config.hasFBConfig() ) { // not able to use FBConfig -> GLX 1.1 @@ -332,23 +340,22 @@ public class X11GLXContext extends GLContextImpl { glXReleaseContext(display); // release temp context GLX.glXDestroyContext(display, contextHandle); contextHandle = 0; - throw new InternalError("setGLFunctionAvailability !strictMatch failed.1"); + throw new GLException("setGLFunctionAvailability !strictMatch failed.1"); } isDirect = GLX.glXIsDirect(display, contextHandle); if (DEBUG) { - System.err.println(getThreadName() + ": createContextImpl: OK (old-1) share "+toHexString(shareWithHandle)+", direct "+isDirect+"/"+direct); + System.err.println(getThreadName() + ": createImpl: OK (old-1) share "+toHexString(shareWithHandle)+", direct "+isDirect+"/"+direct); } return true; } - boolean createContextARBTried = false; // utilize the shared context's GLXExt in case it was using the ARB method and it already exists - if( null != sharedContext && sharedContext.isCreatedWithARBMethod() ) { + if( createContextARBAvailable && sharedCreatedWithARB ) { contextHandle = createContextARB(shareWithHandle, direct); createContextARBTried = true; if ( DEBUG && 0 != contextHandle ) { - System.err.println(getThreadName() + ": createContextImpl: OK (ARB, using sharedContext) share "+toHexString(shareWithHandle)); + System.err.println(getThreadName() + ": createImpl: OK (ARB, using sharedContext) share "+toHexString(shareWithHandle)); } } @@ -366,10 +373,10 @@ public class X11GLXContext extends GLContextImpl { if( !setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, null == sharedContext /* withinGLVersionsMapping */) ) { // use GL_VERSION glXReleaseContext(display); // release temp context GLX.glXDestroyContext(display, temp_ctx); - throw new InternalError("setGLFunctionAvailability !strictMatch failed.2"); + throw new GLException("setGLFunctionAvailability !strictMatch failed.2"); } glXReleaseContext(display); // release temp context - if( !createContextARBTried ) { + if( createContextARBAvailable && !createContextARBTried ) { // is*Available calls are valid since setGLFunctionAvailability(..) was called final boolean isProcCreateContextAttribsARBAvailable = isFunctionAvailable("glXCreateContextAttribsARB"); final boolean isExtARBCreateContextAvailable = isExtensionAvailable("GLX_ARB_create_context"); @@ -379,13 +386,13 @@ public class X11GLXContext extends GLContextImpl { createContextARBTried=true; if (DEBUG) { if( 0 != contextHandle ) { - System.err.println(getThreadName() + ": createContextImpl: OK (ARB, initial) share "+toHexString(shareWithHandle)); + System.err.println(getThreadName() + ": createImpl: OK (ARB, initial) share "+toHexString(shareWithHandle)); } else { - System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - creation failed - share "+toHexString(shareWithHandle)); + System.err.println(getThreadName() + ": createImpl: NOT OK (ARB, initial) - creation failed - share "+toHexString(shareWithHandle)); } } } else if( DEBUG ) { - System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+toHexString(shareWithHandle)+ + System.err.println(getThreadName() + ": createImpl: NOT OK (ARB, initial) - extension not available - share "+toHexString(shareWithHandle)+ ", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+ ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable); } @@ -408,11 +415,11 @@ public class X11GLXContext extends GLContextImpl { // otherwise context of similar profile but different creation method may not be share-able. glXReleaseContext(display); GLX.glXDestroyContext(display, temp_ctx); - throw new GLException(getThreadName()+": X11GLXContext.createContextImpl ARB n/a but required, profile > GL2 requested (OpenGL >= 3.1). Requested: "+glp+", current: "+getGLVersion()); + throw new GLException(getThreadName()+": createImpl ARB n/a but required, profile > GL2 requested (OpenGL >= 3.1). Requested: "+glp+", current: "+getGLVersion()); } - if(DEBUG) { - System.err.println(getThreadName()+": X11GLXContext.createContextImpl ARB not used, fall back to !ARB context "+getGLVersion()); + System.err.println(getThreadName()+": createImpl ARB not used[avail "+createContextARBAvailable+ + ", tried "+createContextARBTried+"], fall back to !ARB context "+getGLVersion()); } // continue with temp context @@ -423,12 +430,12 @@ public class X11GLXContext extends GLContextImpl { throw new GLException(getThreadName()+": Error making context(1) current: display "+toHexString(display)+", context "+toHexString(contextHandle)+", drawable "+drawable); } if (DEBUG) { - System.err.println(getThreadName() + ": createContextImpl: OK (old-2) share "+toHexString(shareWithHandle)); + System.err.println(getThreadName() + ": createImpl: OK (old-2) share "+toHexString(shareWithHandle)); } } isDirect = GLX.glXIsDirect(display, contextHandle); if (DEBUG) { - System.err.println(getThreadName() + ": createContextImpl: OK direct "+isDirect+"/"+direct); + System.err.println(getThreadName() + ": createImpl: OK direct "+isDirect+"/"+direct); } return true; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLProfile0XBase.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLProfile0XBase.java new file mode 100644 index 000000000..00508bc08 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLProfile0XBase.java @@ -0,0 +1,920 @@ +/** + * Copyright 2010 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +package com.jogamp.opengl.test.junit.jogl.acore; + +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawableFactory; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLProfile; + +import org.junit.Assert; +import org.junit.FixMethodOrder; +import org.junit.runners.MethodSorters; + +import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.opengl.JoglVersion; +import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.UITestCase; + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public abstract class GLProfile0XBase extends UITestCase { + + // + // 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 + // + + protected 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()); + } + protected 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()); + } + + protected 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()); + } + protected 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()); + } + + protected 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()); + } + protected 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()); + if( gles3CompatAvail ) { // possible w/ GL3 implementations! + 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.assertFalse(ctx.isGL4bc()); + Assert.assertFalse(ctx.isGL4()); + Assert.assertTrue(ctx.isGL3bc()); + Assert.assertTrue(ctx.isGL3()); + Assert.assertTrue(ctx.isGL2()); + Assert.assertTrue(ctx.isGL2GL3()); + if( gles3CompatAvail ) { // possible w/ GL3 implementations! + 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()); + } + + protected 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()); + } + protected 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()); + if( gles3CompatAvail ) { // possible w/ GL3 implementations! + 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.assertFalse(ctx.isGL4()); + Assert.assertFalse(ctx.isGL3bc()); + Assert.assertTrue(ctx.isGL3()); + Assert.assertFalse(ctx.isGL2()); + Assert.assertTrue(ctx.isGL2GL3()); + if( gles3CompatAvail ) { // possible w/ GL3 implementations! + 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()); + } + + protected 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()); + } + protected 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()); + } + + protected 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()); + } + protected 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(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()); + } + + protected 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()); + } + protected 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.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()); + } + + protected 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()); + } + protected 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(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()); + } + + protected 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"); + } + } + protected 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"); + } + } + + protected 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"); + } + } + protected 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"); + } + } + + protected 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"); + } + } + protected 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"); + } + } + + protected 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"); + } + } + protected 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"); + } + } + + protected 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)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3bc)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2GL3)); + if( gles3CompatAvail ) { + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4ES3)); + } else { + Assert.assertFalse(GLProfile.isAvailable(GLProfile.GL4ES3)); + } + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); + } else if(glp.getImplName().equals(GLProfile.GL3bc)) { + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3bc)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2GL3)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); + } else if(glp.getImplName().equals(GLProfile.GL2)) { + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2GL3)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); + } else if(glp.getImplName().equals(GLProfile.GL4)) { + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2GL3)); + if( gles3CompatAvail ) { + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4ES3)); + } else { + Assert.assertFalse(GLProfile.isAvailable(GLProfile.GL4ES3)); + } + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); + } else if(glp.getImplName().equals(GLProfile.GL3)) { + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2GL3)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); + } else if(glp.getImplName().equals(GLProfile.GLES3)) { + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GLES3)); + if( gles3CompatAvail ) { + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4ES3)); + } else { + Assert.assertFalse(GLProfile.isAvailable(GLProfile.GL4ES3)); + } + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); + } else if(glp.getImplName().equals(GLProfile.GLES2)) { + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GLES2)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); + } else if(glp.getImplName().equals(GLProfile.GLES1)) { + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GLES1)); + Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1)); + } + 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 if(glp.isGLES1()) { + 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); + } + + } + + protected static void validateOnline(final String requestedProfile, final GLProfile glpReq, final GL gl) { + final GLContext ctx = gl.getContext(); + 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.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()) { + 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 if(gl.isGLES1()) { + validateGLES1(gl); + } + + if( requestedProfile == GLProfile.GL4bc ) { + validateGL4bc(gl); + } else if( requestedProfile == GLProfile.GL3bc ) { + if( gl.isGL4bc() ) { + validateGL4bc(gl); + } else if( gl.isGL3bc() ) { + validateGL3bc(gl); + } else { + throw new GLException("GL3bc is neither GL4bc nor GL3bc"); + } + } else if( requestedProfile == GLProfile.GL2 ) { + if( gl.isGL4bc() ) { + validateGL4bc(gl); + } else if( gl.isGL3bc() ) { + validateGL3bc(gl); + } else if( gl.isGL2() ) { + validateGL2(gl); + } else { + throw new GLException("GL2 is neither GL4bc, GL3bc, GL2"); + } + } 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 { + throw new GLException("GL3 is neither GL4bc, GL3bc, GL4 nor GL3"); + } + } 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); + } + } + + protected void validateOnlineOnscreen(final String requestedProfile, final GLProfile glp) throws InterruptedException { + final GLCapabilitiesImmutable 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); + Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true)); + Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true)); + + glWindow.display(); + Thread.sleep(100); + final boolean disableOpenGLARBContext = null != System.getProperty("jogl.disable.openglarbcontext"); + if( disableOpenGLARBContext ) { + Assert.assertFalse("Property 'jogl.disable.openglarbcontext' set, but created w/ ARB", + glWindow.getContext().isCreatedWithARBMethod()); + } + glWindow.destroy(); + Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, false)); + Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, false)); + } + + protected void validateOnlineOffscreen(final String requestedProfile, final GLCapabilitiesImmutable caps) + throws InterruptedException { + final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); + final GLAutoDrawable glad = factory.createOffscreenAutoDrawable(null, caps, null, 128, 128); + Assert.assertNotNull(glad); + + glad.addGLEventListener(new GLEventListener() { + public void init(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); + System.err.println(JoglVersion.getGLStrings(gl, null, false)); + + validateOnline(requestedProfile, caps.getGLProfile(), 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) { + } + }); + glad.display(); + Thread.sleep(100); + final boolean disableOpenGLARBContext = null != System.getProperty("jogl.disable.openglarbcontext"); + if( disableOpenGLARBContext ) { + Assert.assertFalse("Property 'jogl.disable.openglarbcontext' set, but created w/ ARB", + glad.getContext().isCreatedWithARBMethod()); + } + glad.destroy(); + } +} 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 6da1ff90b..2921e8102 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 @@ -30,16 +30,9 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; -import com.jogamp.opengl.GL; -import com.jogamp.opengl.GLAutoDrawable; -import com.jogamp.opengl.GLCapabilities; -import com.jogamp.opengl.GLContext; import com.jogamp.opengl.GLDrawableFactory; -import com.jogamp.opengl.GLEventListener; -import com.jogamp.opengl.GLException; import com.jogamp.opengl.GLProfile; -import org.junit.Assert; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; @@ -48,12 +41,10 @@ import com.jogamp.common.GlueGenVersion; import com.jogamp.common.util.VersionUtil; import com.jogamp.nativewindow.NativeWindowVersion; import com.jogamp.newt.NewtVersion; -import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.JoglVersion; -import com.jogamp.opengl.test.junit.util.UITestCase; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestGLProfile01NEWT extends UITestCase { +public class TestGLProfile01NEWT extends GLProfile0XBase { @Test public void test00Version() throws InterruptedException { @@ -73,832 +64,6 @@ public class TestGLProfile01NEWT extends UITestCase { } } - // - // 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()); - if( gles3CompatAvail ) { // possible w/ GL3 implementations! - 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.assertFalse(ctx.isGL4bc()); - Assert.assertFalse(ctx.isGL4()); - Assert.assertTrue(ctx.isGL3bc()); - Assert.assertTrue(ctx.isGL3()); - Assert.assertTrue(ctx.isGL2()); - Assert.assertTrue(ctx.isGL2GL3()); - if( gles3CompatAvail ) { // possible w/ GL3 implementations! - 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 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()); - if( gles3CompatAvail ) { // possible w/ GL3 implementations! - 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.assertFalse(ctx.isGL4()); - Assert.assertFalse(ctx.isGL3bc()); - Assert.assertTrue(ctx.isGL3()); - Assert.assertFalse(ctx.isGL2()); - Assert.assertTrue(ctx.isGL2GL3()); - if( gles3CompatAvail ) { // possible w/ GL3 implementations! - 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 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(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.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(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)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3bc)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2GL3)); - if( gles3CompatAvail ) { - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4ES3)); - } else { - Assert.assertFalse(GLProfile.isAvailable(GLProfile.GL4ES3)); - } - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); - } else if(glp.getImplName().equals(GLProfile.GL3bc)) { - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3bc)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2GL3)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); - } else if(glp.getImplName().equals(GLProfile.GL2)) { - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2GL3)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); - } else if(glp.getImplName().equals(GLProfile.GL4)) { - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2GL3)); - if( gles3CompatAvail ) { - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4ES3)); - } else { - Assert.assertFalse(GLProfile.isAvailable(GLProfile.GL4ES3)); - } - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); - } else if(glp.getImplName().equals(GLProfile.GL3)) { - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL3)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2GL3)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); - } else if(glp.getImplName().equals(GLProfile.GLES3)) { - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GLES3)); - if( gles3CompatAvail ) { - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4ES3)); - } else { - Assert.assertFalse(GLProfile.isAvailable(GLProfile.GL4ES3)); - } - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); - } else if(glp.getImplName().equals(GLProfile.GLES2)) { - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GLES2)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES2)); - } else if(glp.getImplName().equals(GLProfile.GLES1)) { - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GLES1)); - Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL2ES1)); - } - 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 if(glp.isGLES1()) { - 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 validateOnline(final String requestedProfile, final GLProfile glpReq, final GL gl) { - final GLContext ctx = gl.getContext(); - 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.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()) { - 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 if(gl.isGLES1()) { - validateGLES1(gl); - } - - if( requestedProfile == GLProfile.GL4bc ) { - validateGL4bc(gl); - } else if( requestedProfile == GLProfile.GL3bc ) { - if( gl.isGL4bc() ) { - validateGL4bc(gl); - } else if( gl.isGL3bc() ) { - validateGL3bc(gl); - } else { - throw new GLException("GL3bc is neither GL4bc nor GL3bc"); - } - } else if( requestedProfile == GLProfile.GL2 ) { - if( gl.isGL4bc() ) { - validateGL4bc(gl); - } else if( gl.isGL3bc() ) { - validateGL3bc(gl); - } else if( gl.isGL2() ) { - validateGL2(gl); - } else { - throw new GLException("GL2 is neither GL4bc, GL3bc, GL2"); - } - } 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 { - throw new GLException("GL3 is neither GL4bc, GL3bc, GL4 nor GL3"); - } - } 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()); @@ -906,7 +71,7 @@ public class TestGLProfile01NEWT extends UITestCase { final GLProfile glp = GLProfile.getDefault(); System.out.println("GLProfile.getDefault(): "+glp); validateOffline("default", glp); - validateOnline("default", glp); + validateOnlineOnscreen("default", glp); } @Test @@ -915,7 +80,7 @@ public class TestGLProfile01NEWT extends UITestCase { final GLProfile glp = GLProfile.getMaxProgrammable(true); System.out.println("GLProfile.getMaxProgrammable(): "+glp); validateOffline("maxProgrammable", glp); - validateOnline("maxProgrammable", glp); + validateOnlineOnscreen("maxProgrammable", glp); } @Test @@ -924,7 +89,7 @@ public class TestGLProfile01NEWT extends UITestCase { final GLProfile glp = GLProfile.getMaxFixedFunc(true); System.out.println("GLProfile.getMaxFixedFunc(): "+glp); validateOffline("maxFixedFunc", glp); - validateOnline("maxFixedFunc", glp); + validateOnlineOnscreen("maxFixedFunc", glp); } @Test @@ -935,7 +100,7 @@ public class TestGLProfile01NEWT extends UITestCase { } final GLProfile glp = GLProfile.getGL2ES1(); validateOffline(GLProfile.GL2ES1, glp); - validateOnline(GLProfile.GL2ES1, glp); + validateOnlineOnscreen(GLProfile.GL2ES1, glp); } @Test @@ -946,7 +111,7 @@ public class TestGLProfile01NEWT extends UITestCase { } final GLProfile glp = GLProfile.getGL2ES2(); validateOffline(GLProfile.GL2ES2, glp); - validateOnline(GLProfile.GL2ES2, glp); + validateOnlineOnscreen(GLProfile.GL2ES2, glp); } @Test @@ -957,7 +122,7 @@ public class TestGLProfile01NEWT extends UITestCase { } final GLProfile glp = GLProfile.getGL4ES3(); validateOffline(GLProfile.GL4ES3, glp); - validateOnline(GLProfile.GL4ES3, glp); + validateOnlineOnscreen(GLProfile.GL4ES3, glp); } @Test @@ -968,14 +133,14 @@ public class TestGLProfile01NEWT extends UITestCase { } final GLProfile glp = GLProfile.getGL2GL3(); validateOffline(GLProfile.GL2GL3, glp); - validateOnline(GLProfile.GL2GL3, glp); + validateOnlineOnscreen(GLProfile.GL2GL3, glp); } void testSpecificProfile(final String glps) throws InterruptedException { if(GLProfile.isAvailable(glps)) { final GLProfile glp = GLProfile.get(glps); validateOffline(glps, glp); - validateOnline(glps, glp); + validateOnlineOnscreen(glps, glp); } else { System.err.println("Profile "+glps+" n/a"); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile02NEWTNoARBCtx.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile02NEWTNoARBCtx.java new file mode 100644 index 000000000..bc9dee99c --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile02NEWTNoARBCtx.java @@ -0,0 +1,50 @@ +/** + * Copyright 2010 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +package com.jogamp.opengl.test.junit.jogl.acore; + +import java.io.IOException; + +import org.junit.BeforeClass; +import org.junit.FixMethodOrder; +import org.junit.runners.MethodSorters; + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestGLProfile02NEWTNoARBCtx extends TestGLProfile01NEWT { + + @BeforeClass + public static void setNoARBCtx() { + System.setProperty("jogl.disable.openglarbcontext", "true"); + } + + public static void main(final String args[]) throws IOException { + final String tstname = TestGLProfile02NEWTNoARBCtx.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } + +} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile03NEWTOffscreen.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile03NEWTOffscreen.java new file mode 100644 index 000000000..12cb0d6a8 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile03NEWTOffscreen.java @@ -0,0 +1,182 @@ +/** + * Copyright 2010 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +package com.jogamp.opengl.test.junit.jogl.acore; + +import java.io.IOException; + +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLCapabilitiesImmutable; +import com.jogamp.opengl.GLProfile; + +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runners.MethodSorters; + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestGLProfile03NEWTOffscreen extends GLProfile0XBase { + + @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); + final GLCapabilitiesImmutable caps = new GLCapabilities(glp); + validateOnlineOffscreen("default", caps); + } + + @Test + public void test02GLProfileDefaultBitmap() 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); + final GLCapabilities caps = new GLCapabilities(glp); + caps.setBitmap(true); + validateOnlineOffscreen("default", caps); + } + + @Test + public void test02GLProfileMaxProgrammable() throws InterruptedException { + // Assuming at least one programmable profile is available + final GLProfile glp = GLProfile.getMaxProgrammable(true); + System.out.println("GLProfile.getMaxProgrammable(): "+glp); + final GLCapabilitiesImmutable caps = new GLCapabilities(glp); + validateOnlineOffscreen("maxProgrammable", caps); + } + + @Test + public void test03GLProfileMaxFixedFunc() throws InterruptedException { + // Assuming at least one fixed function profile is available + final GLProfile glp = GLProfile.getMaxFixedFunc(true); + System.out.println("GLProfile.getMaxFixedFunc(): "+glp); + final GLCapabilitiesImmutable caps = new GLCapabilities(glp); + validateOnlineOffscreen("maxFixedFunc", caps); + } + + @Test + public void test04GLProfileGL2ES1() throws InterruptedException { + if(!GLProfile.isAvailable(GLProfile.GL2ES1)) { + System.out.println("GLProfile GL2ES1 n/a"); + return; + } + final GLProfile glp = GLProfile.getGL2ES1(); + final GLCapabilitiesImmutable caps = new GLCapabilities(glp); + validateOnlineOffscreen(GLProfile.GL2ES1, caps); + } + + @Test + public void test05GLProfileGL2ES2() throws InterruptedException { + if(!GLProfile.isAvailable(GLProfile.GL2ES2)) { + System.out.println("GLProfile GL2ES2 n/a"); + return; + } + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilitiesImmutable caps = new GLCapabilities(glp); + validateOnlineOffscreen(GLProfile.GL2ES2, caps); + } + + @Test + public void test06GLProfileGL4ES3() throws InterruptedException { + if(!GLProfile.isAvailable(GLProfile.GL4ES3)) { + System.out.println("GLProfile GL4ES3 n/a"); + return; + } + final GLProfile glp = GLProfile.getGL4ES3(); + final GLCapabilitiesImmutable caps = new GLCapabilities(glp); + validateOnlineOffscreen(GLProfile.GL4ES3, caps); + } + + @Test + public void test07GLProfileGL2GL3() throws InterruptedException { + if(!GLProfile.isAvailable(GLProfile.GL2GL3)) { + System.out.println("GLProfile GL2GL3 n/a"); + return; + } + final GLProfile glp = GLProfile.getGL2GL3(); + final GLCapabilitiesImmutable caps = new GLCapabilities(glp); + validateOnlineOffscreen(GLProfile.GL2GL3, caps); + } + + void testSpecificProfile(final String glps) throws InterruptedException { + if(GLProfile.isAvailable(glps)) { + final GLProfile glp = GLProfile.get(glps); + final GLCapabilitiesImmutable caps = new GLCapabilities(glp); + validateOnlineOffscreen(glps, caps); + } else { + System.err.println("Profile "+glps+" n/a"); + } + } + + @Test + public void test10_GL4bc() throws InterruptedException { + testSpecificProfile(GLProfile.GL4bc); + } + + @Test + public void test11_GL3bc() throws InterruptedException { + testSpecificProfile(GLProfile.GL3bc); + } + + @Test + public void test12_GL2() throws InterruptedException { + testSpecificProfile(GLProfile.GL2); + } + + @Test + public void test13_GL4() throws InterruptedException { + testSpecificProfile(GLProfile.GL4); + } + + @Test + public void test14_GL3() throws InterruptedException { + testSpecificProfile(GLProfile.GL3); + } + + @Test + public void test15_GLES1() throws InterruptedException { + testSpecificProfile(GLProfile.GLES1); + } + + @Test + public void test16_GLES2() throws InterruptedException { + testSpecificProfile(GLProfile.GLES2); + } + + @Test + public void test17_GLES3() throws InterruptedException { + testSpecificProfile(GLProfile.GLES3); + } + + public static void main(final String args[]) throws IOException { + final String tstname = TestGLProfile03NEWTOffscreen.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } + +} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile04NEWTOffscreenNoARBCtx.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile04NEWTOffscreenNoARBCtx.java new file mode 100644 index 000000000..100534f39 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile04NEWTOffscreenNoARBCtx.java @@ -0,0 +1,50 @@ +/** + * Copyright 2010 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +package com.jogamp.opengl.test.junit.jogl.acore; + +import java.io.IOException; + +import org.junit.BeforeClass; +import org.junit.FixMethodOrder; +import org.junit.runners.MethodSorters; + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestGLProfile04NEWTOffscreenNoARBCtx extends TestGLProfile03NEWTOffscreen { + + @BeforeClass + public static void setNoARBCtx() { + System.setProperty("jogl.disable.openglarbcontext", "true"); + } + + public static void main(final String args[]) throws IOException { + final String tstname = TestGLProfile04NEWTOffscreenNoARBCtx.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } + +} |