diff options
-rwxr-xr-x | make/scripts/tests.sh | 4 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java | 11 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 29 |
3 files changed, 36 insertions, 8 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 0db48b289..92a492c74 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -245,7 +245,7 @@ function testawtswt() { #testnoawt com.jogamp.newt.opengl.GLWindow $* #testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen01GLPBufferNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen02BitmapNEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* +testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFloatUtil01MatrixMatrixMultNOUI $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestPMVMatrix01NEWT $* @@ -378,7 +378,7 @@ function testawtswt() { #testawt com.jogamp.opengl.test.junit.newt.TestKeyEventOrderNEWT $* #testawt com.jogamp.opengl.test.junit.newt.TestKeyEventAutoRepeatNEWT $* #testawt com.jogamp.opengl.test.junit.newt.TestKeyPressReleaseUnmaskRepeatNEWT $* -testawt com.jogamp.opengl.test.junit.newt.TestKeyCodeNEWT $* +#testawt com.jogamp.opengl.test.junit.newt.TestKeyCodeNEWT $* #testawt com.jogamp.opengl.test.junit.newt.TestListenerCom01AWT #testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01aAWT $* #testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01bAWT $* diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java index 82799bf67..51944cb71 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java +++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java @@ -58,12 +58,19 @@ public class GLRendererQuirks { /** SIGSEGV on setSwapInterval() after changing the context's drawable w/ 'Mesa 8.0.4' dri2SetSwapInterval/DRI2 (soft & intel) */ public static final int NoSetSwapIntervalPostRetarget = 4; + + /** Requires a bound VAO for vertex attribute operations, i.e. GL impl. uses no default VAO. Violates GL 3.2. On OSX OpenGL 3.2 context. FIXME: Constrain version. */ + public static final int RequiresBoundVAO = 5; + + /** GLSL <code>discard</code> command leads to undefined behavior or won't get compiled if being used. Appears to happen on Nvidia Tegra2. FIXME: Constrain version. */ + public static final int GLSLBuggyDiscard = 6; /** Number of quirks known. */ - public static final int COUNT = 5; + public static final int COUNT = 7; private static final String[] _names = new String[] { "NoDoubleBufferedPBuffer", "NoDoubleBufferedBitmap", "NoSetSwapInterval", - "NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget" + "NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget", "RequiresBoundVAO", + "GLSLBuggyDiscard" }; private final int _bitmask; diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index d2e0bb407..48184119b 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -98,7 +98,8 @@ public abstract class GLContextImpl extends GLContext { private final GLStateTracker glStateTracker = new GLStateTracker(); private GLDebugMessageHandler glDebugHandler = null; private final int[] boundFBOTarget = new int[] { 0, 0 }; // { draw, read } - + private int defaultVAO = 0; + protected GLDrawableImpl drawable; protected GLDrawableImpl drawableRead; @@ -347,6 +348,12 @@ public abstract class GLContextImpl extends GLContext { } catch (Throwable t) { drawableContextRealizedException = t; } + if(0 != defaultVAO) { + int[] tmp = new int[] { defaultVAO }; + gl.getGL2GL3().glBindVertexArray(0); + gl.getGL2GL3().glDeleteVertexArrays(1, tmp, 0); + defaultVAO = 0; + } glDebugHandler.enable(false); if(lock.getHoldCount() > 1) { // pending release() after makeCurrent() @@ -563,6 +570,13 @@ public abstract class GLContextImpl extends GLContext { final boolean created; try { created = createImpl(shareWith); // may throws exception if fails! + if( created && glRendererQuirks.exist(GLRendererQuirks.RequiresBoundVAO) ) { + // Workaround: Create a default VAO to be used per default on makeCurrent + final int[] tmp = new int[1]; + gl.getGL2GL3().glGenVertexArrays(1, tmp, 0); + defaultVAO = tmp[0]; + gl.getGL2GL3().glBindVertexArray(defaultVAO); + } } finally { if (null != shareWith) { shareWith.getDrawableImpl().unlockSurface(); @@ -1292,11 +1306,18 @@ public abstract class GLContextImpl extends GLContext { // OS related quirks if( Platform.getOSType() == Platform.OSType.MACOS ) { - final int quirk = GLRendererQuirks.NoOffscreenBitmap; + final int quirk1 = GLRendererQuirks.NoOffscreenBitmap; if(DEBUG) { - System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()); + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk1)+": cause: OS "+Platform.getOSType()); + } + quirks[i++] = quirk1; + if( 3 <= ctxMajorVersion ) { + final int quirk2 = GLRendererQuirks.RequiresBoundVAO; + if(DEBUG) { + System.err.println("Quirk: "+GLRendererQuirks.toString(quirk2)+": cause: OS "+Platform.getOSType()); + } + quirks[i++] = quirk2; } - quirks[i++] = quirk; } else if( Platform.getOSType() == Platform.OSType.WINDOWS ) { final int quirk = GLRendererQuirks.NoDoubleBufferedBitmap; if(DEBUG) { |