summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-10-29 15:42:44 +0100
committerSven Gothel <[email protected]>2012-10-29 15:42:44 +0100
commitb961225542227ec30f4b79c4425384e7e161437c (patch)
treee7407002e0558291ae27618fa2ef49cb81011ad2 /src
parent3c8a814d7fb536f298507413f290309ed7c0f24e (diff)
GLRendererQuirks.RequiresBoundVAO: Removed, it _is_ in the GL 3.2 core spec - Setting up default VAO for all GL >= 3.2 core ctx.
Refines commit 9b6448b1d54716fd455c0cad0c6133c0edeb3bb8 Due to GL 3.2 core spec: E.2. DEPRECATED AND REMOVED FEATURES (p 331) "There is no more default VAO buffer 0 bound, hence generating and binding one to avoid INVALID_OPERATION at VertexAttribPointer." More clear is GL 4.3 core spec: 10.4 (p 307): "An INVALID_OPERATION error is generated by any commands which modify, draw from, or query vertex array state when no vertex array is bound. This occurs in the initial GL state, and may occur as a result of BindVertexAr- ray or a side effect of DeleteVertexArrays." +++ I just have read (same spec) 2.10 (p 46/47): "An INVALID_OPERATION error is generated if any of the *Pointer commands specifying the location and organization of vertex array data are called while zero is bound to the ARRAY_BUFFER buffer object binding point, and the pointer argu- ment is not NULL." .. which only constraints the *Pointer command use to _VBO_, not forcing a VAO. +++
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java10
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java13
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java14
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java19
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java27
5 files changed, 64 insertions, 19 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
index 51944cb71..2f453a497 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
@@ -59,18 +59,14 @@ 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;
+ public static final int GLSLBuggyDiscard = 5;
/** Number of quirks known. */
- public static final int COUNT = 7;
+ public static final int COUNT = 6;
private static final String[] _names = new String[] { "NoDoubleBufferedPBuffer", "NoDoubleBufferedBitmap", "NoSetSwapInterval",
- "NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget", "RequiresBoundVAO",
- "GLSLBuggyDiscard"
+ "NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget", "GLSLBuggyDiscard"
};
private final int _bitmask;
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index ddb222bfe..de10a2815 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -814,6 +814,12 @@ public abstract class GLContext {
&& 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE));
}
+ /** Indicates whether this profile is capable of GL4 (core only). <p>Includes [ GL4 ].</p> */
+ public final boolean isGL4core() {
+ return ctxMajorVersion>=4 && 0 != (ctxOptions & CTX_IS_ARB_CREATED)
+ && 0 != (ctxOptions & CTX_PROFILE_CORE);
+ }
+
/** @see GLProfile#isGL3bc() */
public final boolean isGL3bc() {
return ( ctxMajorVersion>3 || ctxMajorVersion==3 && ctxMinorVersion>=1 )
@@ -828,6 +834,13 @@ public abstract class GLContext {
&& 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE));
}
+ /** Indicates whether this profile is capable of GL3 (core only). <p>Includes [ GL4, GL3 ].</p> */
+ public final boolean isGL3core() {
+ return ( ctxMajorVersion>3 || ctxMajorVersion==3 && ctxMinorVersion>=1 )
+ && 0 != (ctxOptions & CTX_IS_ARB_CREATED)
+ && 0 != (ctxOptions & CTX_PROFILE_CORE);
+ }
+
/** @see GLProfile#isGL2() */
public final boolean isGL2() {
return ctxMajorVersion>=1 && 0!=(ctxOptions & CTX_PROFILE_COMPAT);
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index a211f3840..65b523394 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -570,8 +570,11 @@ 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
+ if( created && isGL3core() && ( ctxMajorVersion>3 || ctxMajorVersion==3 && ctxMinorVersion>=2 ) ) {
+ // Due to GL 3.2 core spec: E.2. DEPRECATED AND REMOVED FEATURES (p 331)
+ // There is no more default VAO buffer 0 bound, hence generating and binding one
+ // to avoid INVALID_OPERATION at VertexAttribPointer.
+ // More clear is GL 4.3 core spec: 10.4 (p 307).
final int[] tmp = new int[1];
gl.getGL2GL3().glGenVertexArrays(1, tmp, 0);
defaultVAO = tmp[0];
@@ -1311,13 +1314,6 @@ public abstract class GLContextImpl extends GLContext {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk1)+": cause: OS "+Platform.getOSType());
}
quirks[i++] = quirk1;
- if( isGL3() ) {
- final int quirk2 = GLRendererQuirks.RequiresBoundVAO;
- if(DEBUG) {
- System.err.println("Quirk: "+GLRendererQuirks.toString(quirk2)+": cause: OS "+Platform.getOSType());
- }
- quirks[i++] = quirk2;
- }
} else if( Platform.getOSType() == Platform.OSType.WINDOWS ) {
final int quirk = GLRendererQuirks.NoDoubleBufferedBitmap;
if(DEBUG) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
index d2c00f980..90f2ab988 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
@@ -89,6 +89,7 @@ public class TestGearsES2NEWT extends UITestCase {
static boolean loop_shutdown = false;
static boolean forceES2 = false;
static boolean forceGL3 = false;
+ static boolean mainRun = false;
@BeforeClass
public static void initClass() {
@@ -265,7 +266,7 @@ public class TestGearsES2NEWT extends UITestCase {
} else {
glp = GLProfile.getGL2ES2();
}
- GLCapabilities caps = new GLCapabilities( glp );
+ final GLCapabilities caps = new GLCapabilities( glp );
caps.setBackgroundOpaque(opaque);
if(-1 < forceAlpha) {
caps.setAlphaBits(forceAlpha);
@@ -277,7 +278,21 @@ public class TestGearsES2NEWT extends UITestCase {
}
}
- public static void main(String args[]) throws IOException {
+ @Test
+ public void test02GL3() throws InterruptedException {
+ if(mainRun) return;
+
+ if( !GLProfile.isAvailable(GLProfile.GL3) ) {
+ System.err.println("GL3 n/a");
+ }
+ final GLProfile glp = GLProfile.get(GLProfile.GL3);
+ final GLCapabilities caps = new GLCapabilities( glp );
+ runTestGL(caps, undecorated);
+ }
+
+ public static void main(String args[]) throws IOException {
+ mainRun = true;
+
int x=0, y=0, w=640, h=480;
boolean usePos = false;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
index f0c3bb684..21c09f78c 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
@@ -54,6 +54,8 @@ public class TestRedSquareES2NEWT extends UITestCase {
static boolean loop_shutdown = false;
static boolean vsync = false;
static boolean forceES2 = false;
+ static boolean forceGL3 = false;
+ static boolean mainRun = false;
static boolean doRotate = true;
@BeforeClass
@@ -127,17 +129,38 @@ public class TestRedSquareES2NEWT extends UITestCase {
public void test01GL2ES2() throws InterruptedException {
for(int i=1; i<=loops; i++) {
System.err.println("Loop "+i+"/"+loops);
- GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2());
+ final GLProfile glp;
+ if(forceGL3) {
+ glp = GLProfile.get(GLProfile.GL3);
+ } else if(forceES2) {
+ glp = GLProfile.get(GLProfile.GLES2);
+ } else {
+ glp = GLProfile.getGL2ES2();
+ }
+ final GLCapabilities caps = new GLCapabilities(glp);
runTestGL(caps);
if(loop_shutdown) {
GLProfile.shutdown();
}
}
}
+
+ @Test
+ public void test02GL3() throws InterruptedException {
+ if(mainRun) return;
+
+ if( !GLProfile.isAvailable(GLProfile.GL3) ) {
+ System.err.println("GL3 n/a");
+ }
+ final GLProfile glp = GLProfile.get(GLProfile.GL3);
+ final GLCapabilities caps = new GLCapabilities( glp );
+ runTestGL(caps);
+ }
static long duration = 500; // ms
public static void main(String args[]) {
+ mainRun = true;
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
i++;
@@ -146,6 +169,8 @@ public class TestRedSquareES2NEWT extends UITestCase {
} catch (Exception ex) { ex.printStackTrace(); }
} else if(args[i].equals("-es2")) {
forceES2 = true;
+ } else if(args[i].equals("-gl3")) {
+ forceGL3 = true;
} else if(args[i].equals("-norotate")) {
doRotate = false;
} else if(args[i].equals("-loops")) {