summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/scripts/tests.sh4
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java21
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java23
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java30
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java1
6 files changed, 65 insertions, 30 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index d403a4201..48de758b5 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -370,12 +370,12 @@ function testawtswt() {
#testnoawt com.jogamp.newt.NewtVersion $*
#testnoawt com.jogamp.oculusvr.OVRVersion $*
-testnoawt com.jogamp.newt.opengl.GLWindow $*
+#testnoawt com.jogamp.newt.opengl.GLWindow $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLVersionParsing00NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $*
#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.TestGLProfile01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestVersionSemanticsNOUI $*
#
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 09a60d304..863eb1a1e 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -976,8 +976,7 @@ public abstract class GLContext {
* @see GLProfile#isGL4bc()
*/
public final boolean isGL4bc() {
- return 0 != (ctxOptions & CTX_IS_ARB_CREATED) &&
- 0 != (ctxOptions & CTX_PROFILE_COMPAT) &&
+ return 0 != (ctxOptions & CTX_PROFILE_COMPAT) &&
ctxVersion.getMajor() >= 4;
}
@@ -986,8 +985,7 @@ public abstract class GLContext {
* @see GLProfile#isGL4()
*/
public final boolean isGL4() {
- return 0 != (ctxOptions & CTX_IS_ARB_CREATED) &&
- 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)) &&
+ return 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)) &&
ctxVersion.getMajor() >= 4;
}
@@ -995,8 +993,7 @@ public abstract class GLContext {
* Indicates whether this GLContext uses a GL4 core profile. <p>Includes [ GL4 ].</p>
*/
public final boolean isGL4core() {
- return 0 != ( ctxOptions & CTX_IS_ARB_CREATED ) &&
- 0 != ( ctxOptions & CTX_PROFILE_CORE ) &&
+ return 0 != ( ctxOptions & CTX_PROFILE_CORE ) &&
ctxVersion.getMajor() >= 4;
}
@@ -1005,8 +1002,7 @@ public abstract class GLContext {
* @see GLProfile#isGL3bc()
*/
public final boolean isGL3bc() {
- return 0 != (ctxOptions & CTX_IS_ARB_CREATED) &&
- 0 != (ctxOptions & CTX_PROFILE_COMPAT) &&
+ return 0 != (ctxOptions & CTX_PROFILE_COMPAT) &&
ctxVersion.compareTo(Version310) >= 0 ;
}
@@ -1015,8 +1011,7 @@ public abstract class GLContext {
* @see GLProfile#isGL3()
*/
public final boolean isGL3() {
- return 0 != (ctxOptions & CTX_IS_ARB_CREATED) &&
- 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)) &&
+ return 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)) &&
ctxVersion.compareTo(Version310) >= 0 ;
}
@@ -1024,8 +1019,7 @@ public abstract class GLContext {
* Indicates whether this GLContext uses a GL3 core profile. <p>Includes [ GL4, GL3 ].</p>
*/
public final boolean isGL3core() {
- return 0 != ( ctxOptions & CTX_IS_ARB_CREATED ) &&
- 0 != ( ctxOptions & CTX_PROFILE_CORE ) &&
+ return 0 != ( ctxOptions & CTX_PROFILE_CORE ) &&
ctxVersion.compareTo(Version310) >= 0;
}
@@ -1034,8 +1028,7 @@ public abstract class GLContext {
*/
public final boolean isGLcore() {
return ( 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 2 ) ||
- ( 0 != ( ctxOptions & CTX_IS_ARB_CREATED ) &&
- 0 != ( ctxOptions & CTX_PROFILE_CORE ) &&
+ ( 0 != ( ctxOptions & CTX_PROFILE_CORE ) &&
ctxVersion.compareTo(Version310) >= 0
) ;
}
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 4632aaadc..be0088f89 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -704,13 +704,32 @@ public abstract class GLContextImpl extends GLContext {
} else {
reqMajor = ctxVersion.getMajor();
}
+ final boolean isCompat;
if( 0 != ( ctxOptions & GLContext.CTX_PROFILE_CORE) ) {
reqProfile = GLContext.CTX_PROFILE_CORE;
+ isCompat = false;
} else {
reqProfile = GLContext.CTX_PROFILE_COMPAT;
+ isCompat = true;
+ }
+ GLContext.mapAvailableGLVersion(device, reqMajor, reqProfile, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
+ // Perform all required profile mappings
+ if( isCompat ) {
+ // COMPAT via non ARB
+ GLContext.mapAvailableGLVersion(device, reqMajor, GLContext.CTX_PROFILE_CORE, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
+ if( reqMajor >= 4 ) {
+ GLContext.mapAvailableGLVersion(device, 3, reqProfile, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
+ GLContext.mapAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_CORE, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
+ }
+ if( reqMajor >= 3 ) {
+ GLContext.mapAvailableGLVersion(device, 2, reqProfile, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
+ }
+ } else {
+ // CORE via non ARB, unlikely, however ..
+ if( reqMajor >= 4 ) {
+ GLContext.mapAvailableGLVersion(device, 3, reqProfile, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
+ }
}
- GLContext.mapAvailableGLVersion(device, reqMajor, reqProfile,
- ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
GLContext.setAvailableGLVersionsSet(device);
if (DEBUG) {
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
index 00f5687a5..33980d663 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
@@ -51,6 +51,7 @@ import javax.media.nativewindow.NativeSurface;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLException;
import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLProfile;
import com.jogamp.common.nio.Buffers;
import com.jogamp.gluegen.runtime.ProcAddressTable;
@@ -330,7 +331,7 @@ public class WindowsWGLContext extends GLContextImpl {
isProcCreateContextAttribsARBAvailable = false;
isExtARBCreateContextAvailable = false;
}
- if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable ) {
+ if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable && !GLProfile.disableOpenGLARBContext ) {
// initial ARB context creation
contextHandle = createContextARB(shareWithHandle, true);
createContextARBTried=true;
@@ -343,7 +344,9 @@ public class WindowsWGLContext extends GLContextImpl {
}
} else if (DEBUG) {
System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+toHexString(shareWithHandle)+
- ", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable);
+ ", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+
+ ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable+
+ ", disableOpenGLARBContext "+GLProfile.disableOpenGLARBContext);
}
}
} else {
@@ -360,8 +363,15 @@ public class WindowsWGLContext extends GLContextImpl {
}
}
} else {
+ if( glCaps.getGLProfile().isGL3() && createContextARBTried ) {
+ // We shall not allow context creation >= GL3 w/ non ARB methods if ARB is used,
+ // 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.0.1). Requested: "+glCaps.getGLProfile()+", current: "+getGLVersion());
+ }
if(DEBUG) {
- System.err.println("WindowsWGLContext.createContext via ARB failed, fall back to !ARB context "+getGLVersion());
+ System.err.println("WindowsWGLContext.createContext ARB not used, fall back to !ARB context "+getGLVersion());
}
// continue with temp context
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index d93b2feb0..9631dbb5b 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -51,6 +51,7 @@ import javax.media.nativewindow.NativeSurface;
import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLException;
+import javax.media.opengl.GLProfile;
import jogamp.nativewindow.x11.X11Lib;
import jogamp.nativewindow.x11.X11Util;
@@ -297,11 +298,12 @@ public class X11GLXContext extends GLContextImpl {
}
final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
+ final GLProfile glp = glCaps.getGLProfile();
if( !config.hasFBConfig() ) {
// not able to use FBConfig -> GLX 1.1
forceGLXVersionOneOne();
- if(glCaps.getGLProfile().isGL3()) {
+ if( glp.isGL3() ) {
throw new GLException(getThreadName()+": Unable to create OpenGL >= 3.1 context w/o FBConfig");
}
contextHandle = GLX.glXCreateContext(display, config.getXVisualInfo(), shareWithHandle, direct);
@@ -341,7 +343,7 @@ public class X11GLXContext extends GLContextImpl {
throw new GLException(getThreadName()+": Unable to create temp OpenGL context(1)");
}
if ( !glXMakeContextCurrent(display, drawable.getHandle(), drawableRead.getHandle(), temp_ctx) ) {
- throw new GLException(getThreadName()+": Error making temp context(1) current: display "+toHexString(display)+", context "+toHexString(temp_ctx)+", drawable "+drawable);
+ throw new GLException(getThreadName()+": Error making temp context(1) current: display "+toHexString(display)+", context "+toHexString(temp_ctx)+", drawable "+drawable);
}
setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, null == sharedContext /* withinGLVersionsMapping */); // use GL_VERSION
glXMakeContextCurrent(display, 0, 0, 0); // release temp context
@@ -349,7 +351,7 @@ public class X11GLXContext extends GLContextImpl {
// is*Available calls are valid since setGLFunctionAvailability(..) was called
final boolean isProcCreateContextAttribsARBAvailable = isFunctionAvailable("glXCreateContextAttribsARB");
final boolean isExtARBCreateContextAvailable = isExtensionAvailable("GLX_ARB_create_context");
- if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable ) {
+ if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable && !GLProfile.disableOpenGLARBContext ) {
// initial ARB context creation
contextHandle = createContextARB(shareWithHandle, direct);
createContextARBTried=true;
@@ -360,9 +362,11 @@ public class X11GLXContext extends GLContextImpl {
System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - creation failed - share "+toHexString(shareWithHandle));
}
}
- } else if (DEBUG) {
+ } else if( DEBUG ) {
System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+toHexString(shareWithHandle)+
- ", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable);
+ ", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+
+ ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable+
+ ", disableOpenGLARBContext "+GLProfile.disableOpenGLARBContext);
}
}
} else {
@@ -378,16 +382,24 @@ public class X11GLXContext extends GLContextImpl {
}
}
} else {
+ if( glp.isGL3() && createContextARBTried ) {
+ // We shall not allow context creation >= GL3 w/ non ARB methods if ARB is used,
+ // otherwise context of similar profile but different creation method may not be share-able.
+ glXMakeContextCurrent(display, 0, 0, 0);
+ GLX.glXDestroyContext(display, temp_ctx);
+ throw new GLException(getThreadName()+": X11GLXContext.createContextImpl ctx !ARB but ARB is used, profile > GL2 requested (OpenGL >= 3.0.1). Requested: "+glp+", current: "+getGLVersion());
+ }
+
if(DEBUG) {
- System.err.println(getThreadName()+": X11GLXContext.createContextImpl via ARB failed, fall back to !ARB context "+getGLVersion());
+ System.err.println(getThreadName()+": X11GLXContext.createContextImpl ARB not used, fall back to !ARB context "+getGLVersion());
}
// continue with temp context
contextHandle = temp_ctx;
if ( !glXMakeContextCurrent(display, drawable.getHandle(), drawableRead.getHandle(), contextHandle) ) {
- glXMakeContextCurrent(display, 0, 0, 0);
- GLX.glXDestroyContext(display, temp_ctx);
- throw new GLException(getThreadName()+": Error making context(1) current: display "+toHexString(display)+", context "+toHexString(contextHandle)+", drawable "+drawable);
+ glXMakeContextCurrent(display, 0, 0, 0);
+ GLX.glXDestroyContext(display, temp_ctx);
+ 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));
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 633a2822e..9e875130a 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
@@ -78,6 +78,7 @@ public class TestGLProfile01NEWT extends UITestCase {
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 ) {