From bcfaa149b9803ce33c5a356cbcb45f7dfd3e4361 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 28 Oct 2013 03:58:01 +0100 Subject: Bug 776 GLContext Sharing: Add note about driver stability (destruction order) ; Fix unit tests (Shared Gears, wait for created context and destruction order) - Add note about driver stability (destruction order) - See GLSharedContextSetter: Don't destroy master context before slaves! - Fix spec-overview.html#SHARED links, add link to GLSharedContextSetter in SHARED subsection. - Fix unit tests (Shared Gears, wait for created context and destruction order) - The GearsObject sharing was completly bogus! It simply used the _same_ GLArrayDataServer instance for sharing, but it should use a _copy_ of the shared GLArrayDataServer while only preserving the VBO object! Fixed, while adding required methods to GLArrayDataServer. - Waiting for the created GLContext of a GLAutoDrawable required us to pass the latter _and_ check whether it's GLContext exists and is natively created. - Accomodated the destruction order - see above! --- .../com/jogamp/opengl/util/GLArrayDataServer.java | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'src/jogl/classes/com') diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java index e30fea2f4..96643ae72 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java @@ -230,6 +230,28 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE return ads; } + /** + * Create a VBO for fixed function interleaved array data + * starting with a given Buffer object incl it's stride + *

User needs to configure the interleaved segments via {@link #addFixedSubArray(int, int, int)}.

+ * + * @param comps The total number of all interleaved components. + * @param dataType The array index GL data type + * @param normalized Whether the data shall be normalized + * @param initialElementCount + * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} + */ + public static GLArrayDataServer createFixedInterleaved(int comps, int dataType, boolean normalized, int stride, Buffer buffer, + int vboUsage) + throws GLException + { + GLArrayDataServer ads = new GLArrayDataServer(); + GLArrayHandler glArrayHandler = new GLArrayHandlerInterleaved(ads); + ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, comps, dataType, normalized, stride, buffer, buffer.limit(), false, glArrayHandler, + 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, false); + return ads; + } + /** * Configure a segment of this fixed function interleaved array (see {@link #createFixedInterleaved(int, int, boolean, int, int)}). *

@@ -286,6 +308,29 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE return ads; } + /** + * Create a VBO for GLSL interleaved array data + * starting with a given Buffer object incl it's stride + *

User needs to configure the interleaved segments via {@link #addGLSLSubArray(int, int, int)}.

+ * + * @param comps The total number of all interleaved components. + * @param dataType The array index GL data type + * @param normalized Whether the data shall be normalized + * @param stride + * @param buffer the user define data + * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} + */ + public static GLArrayDataServer createGLSLInterleaved(int comps, int dataType, boolean normalized, int stride, Buffer buffer, + int vboUsage) + throws GLException + { + GLArrayDataServer ads = new GLArrayDataServer(); + GLArrayHandler glArrayHandler = new GLSLArrayHandlerInterleaved(ads); + ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, comps, dataType, normalized, stride, buffer, buffer.limit(), false, glArrayHandler, + 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); + return ads; + } + /** * Configure a segment of this GLSL interleaved array (see {@link #createGLSLInterleaved(int, int, boolean, int, int)}). *

-- cgit v1.2.3