From 327d57dcc8f36e9dcce5764367e2bb759e207d92 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Sun, 5 Feb 2006 18:09:23 +0000 Subject: Intermediate checkin for FBO support in Java2D/JOGL bridge. Needed to keep track of server-side OpenGL objects, like textures and display lists, created by the end user to preserve the illusion of independent contexts even though they will all share textures and display lists with the Java2D OpenGL context in order to access its FBO. Added GLObjectTracker class to track creation and destruction of these objects and to support cleanup when the last referring context has been destroyed. Modified GLContextShareSet to create and install GLObjectTrackers when necessary and GLContext to ref and unref tracker appropriately. Changed GlueGen's JavaPrologue and JavaEpilogue directives (and their documentation) to perform argument name substitution. Wrote documentation section on argument name substitution and specified behavior for primitive arrays (converts to string "array_name, array_name_offset" in substitution). Rephrased GlueGen's RangeCheck directives in terms of JavaPrologue directives and deleted old specialized code. Fixed bug in handling of VBO support in GLConfiguration when JavaPrologue was present for affected functions. Added JavaPrologue and JavaEpilogue directives to all existing OpenGL routines creating server-side objects (though it's possible some were missed) to call GLObjectTracker when necessary. Added RangeCheck directives for these routines as well. Worked around bug in JOGL demos where shutdownDemo() was being called more than once. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/trunk@13 a78bb65f-1512-4460-ba86-f6dc96a7bf27 --- src/java/com/sun/gluegen/opengl/GLConfiguration.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/java/com/sun/gluegen') diff --git a/src/java/com/sun/gluegen/opengl/GLConfiguration.java b/src/java/com/sun/gluegen/opengl/GLConfiguration.java index a44f3fe9f..e331d16a4 100755 --- a/src/java/com/sun/gluegen/opengl/GLConfiguration.java +++ b/src/java/com/sun/gluegen/opengl/GLConfiguration.java @@ -125,9 +125,14 @@ public class GLConfiguration extends ProcAddressConfiguration { // Need to generate appropriate prologue based on both buffer // object kind and whether this variant of the MethodBinding // is the one accepting a "long" as argument - if (res == null) { - res = new ArrayList(); + // + // NOTE we MUST NOT mutate the array returned from the super + // call! + ArrayList res2 = new ArrayList(); + if (res != null) { + res2.addAll(res); } + res = res2; String prologue = "check"; @@ -152,6 +157,17 @@ public class GLConfiguration extends ProcAddressConfiguration { prologue = prologue + "();"; res.add(0, prologue); + + // Must also filter out bogus rangeCheck directives for VBO/PBO + // variants + if (emitter.isBufferObjectMethodBinding(binding)) { + for (Iterator iter = res.iterator(); iter.hasNext(); ) { + String line = (String) iter.next(); + if (line.indexOf("BufferFactory.rangeCheck") >= 0) { + iter.remove(); + } + } + } } return res; -- cgit v1.2.3