From b414c4b1be05249590138e73558ada82bd170f15 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 14 Apr 2013 06:28:44 +0200 Subject: Fix Bug 692: Add tracking of VERTEX_ARRAY_BINDING, and enable allowing a bound non default VAO to pass VBO enabled test, even if VBO is disabled. VAO is available if: GL >= 3.0 or is having GL_ARB_vertex_array_object extension. checkBufferObject(..) checks whether VERTEX_ARRAY_BINDING has a non default VAO bound in case no VBO is being bound and VAO is allowed. glBindVertexArray(int) is being tracked, i.e. on state VERTEX_ARRAY_BINDING --- src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java | 2 ++ src/jogl/classes/jogamp/opengl/GLContextImpl.java | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'src/jogl/classes') diff --git a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java index 4a1a81bcb..7f5316fbd 100644 --- a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java @@ -91,6 +91,7 @@ public class GLBufferStateTracker { bindingMap.setKeyNotFoundValue(0xFFFFFFFF); // Start with known unbound targets for known keys + // setBoundBufferObject(GL2GL3.GL_VERTEX_ARRAY_BINDING, 0); // not using default VAO (removed in GL3 core) - only explicit setBoundBufferObject(GL.GL_ARRAY_BUFFER, 0); setBoundBufferObject(GL.GL_ELEMENT_ARRAY_BUFFER, 0); setBoundBufferObject(GL2.GL_PIXEL_PACK_BUFFER, 0); @@ -120,6 +121,7 @@ public class GLBufferStateTracker { boolean gotQueryTarget = true; int queryTarget = 0; switch (target) { + case GL2GL3.GL_VERTEX_ARRAY_BINDING: queryTarget = GL2GL3.GL_VERTEX_ARRAY_BINDING; break; case GL.GL_ARRAY_BUFFER: queryTarget = GL.GL_ARRAY_BUFFER_BINDING; break; case GL.GL_ELEMENT_ARRAY_BUFFER: queryTarget = GL.GL_ELEMENT_ARRAY_BUFFER_BINDING; break; case GL2.GL_PIXEL_PACK_BUFFER: queryTarget = GL2.GL_PIXEL_PACK_BUFFER_BINDING; break; diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 376b3c0e5..9f7c9cf57 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -1790,6 +1790,10 @@ public abstract class GLContextImpl extends GLContext { public final GLStateTracker getGLStateTracker() { return glStateTracker; } + + public final boolean isDefaultVAO(int vao) { + return defaultVAO == vao; + } //--------------------------------------------------------------------------- // Helpers for context optimization where the last context is left -- cgit v1.2.3