diff options
Diffstat (limited to 'src/net/java/games')
-rw-r--r-- | src/net/java/games/gluegen/JavaEmitter.java | 51 | ||||
-rw-r--r-- | src/net/java/games/gluegen/opengl/GLEmitter.java | 9 | ||||
-rw-r--r-- | src/net/java/games/jogl/util/BufferUtils.java | 9 |
3 files changed, 41 insertions, 28 deletions
diff --git a/src/net/java/games/gluegen/JavaEmitter.java b/src/net/java/games/gluegen/JavaEmitter.java index 824b703b4..63350b2e8 100644 --- a/src/net/java/games/gluegen/JavaEmitter.java +++ b/src/net/java/games/gluegen/JavaEmitter.java @@ -391,31 +391,30 @@ public class JavaEmitter implements GlueEmitter { allEmitters.add(entryPointInterface); } - if (cfg.emitImpl() && binding.needsBody() && !isUnimplemented) { - // Generate the method which calls the underlying function - // after unboxing has occurred - PrintWriter output = cfg.allStatic() ? javaWriter() : javaImplWriter(); - JavaMethodBindingEmitter wrappedEntryPoint = - new JavaMethodBindingEmitter(specialBinding, output, cfg.runtimeExceptionType(), true); - wrappedEntryPoint.addModifier(JavaMethodBindingEmitter.PRIVATE); - wrappedEntryPoint.addModifier(JavaMethodBindingEmitter.STATIC); // Doesn't really matter - wrappedEntryPoint.addModifier(JavaMethodBindingEmitter.NATIVE); - allEmitters.add(wrappedEntryPoint); - } - - // If the user has stated that the function will be - // manually implemented, then don't auto-generate a function body. if (cfg.emitImpl()) { - if (!cfg.manuallyImplement(sym.getName()) && !isUnimplemented) - { - CMethodBindingEmitter cEmitter = - makeCEmitter(specialBinding, - overloaded, - (binding != specialBinding), - cfg.implPackageName(), cfg.implClassName(), - cWriter()); - allEmitters.add(cEmitter); + // If the user has stated that the function will be + // manually implemented, then don't auto-generate a function body. + if (!cfg.manuallyImplement(sym.getName()) && !isUnimplemented) { + if (binding.needsBody()) { + // Generate the method which calls the underlying function + // after unboxing has occurred + PrintWriter output = cfg.allStatic() ? javaWriter() : javaImplWriter(); + JavaMethodBindingEmitter wrappedEntryPoint = + new JavaMethodBindingEmitter(specialBinding, output, cfg.runtimeExceptionType(), true); + wrappedEntryPoint.addModifier(JavaMethodBindingEmitter.PRIVATE); + wrappedEntryPoint.addModifier(JavaMethodBindingEmitter.STATIC); // Doesn't really matter + wrappedEntryPoint.addModifier(JavaMethodBindingEmitter.NATIVE); + allEmitters.add(wrappedEntryPoint); } + + CMethodBindingEmitter cEmitter = + makeCEmitter(specialBinding, + overloaded, + (binding != specialBinding), + cfg.implPackageName(), cfg.implClassName(), + cWriter()); + allEmitters.add(cEmitter); + } } } // end iteration over expanded bindings } catch (Exception e) { @@ -1118,6 +1117,12 @@ public class JavaEmitter implements GlueEmitter { protected void emitCHeader(PrintWriter cWriter, String className) { cWriter.println("#include <jni.h>"); cWriter.println(); + + if (getConfig().emitImpl()) { + cWriter.println("#include <assert.h>"); + cWriter.println(); + } + for (Iterator iter = cfg.customCCode().iterator(); iter.hasNext(); ) { cWriter.println((String) iter.next()); } diff --git a/src/net/java/games/gluegen/opengl/GLEmitter.java b/src/net/java/games/gluegen/opengl/GLEmitter.java index 0e64931ba..861e85bb7 100644 --- a/src/net/java/games/gluegen/opengl/GLEmitter.java +++ b/src/net/java/games/gluegen/opengl/GLEmitter.java @@ -67,11 +67,6 @@ public class GLEmitter extends JavaEmitter { this.typedefDictionary = typedefDictionary; - if (getConfig().emitImpl()) { - cWriter().println("#include <assert.h> /* this include emitted by GLEmitter.java */"); - cWriter().println(); - } - if (getGLConfig().emitProcAddressTable()) { beginGLProcAddressTable(); @@ -187,6 +182,10 @@ public class GLEmitter extends JavaEmitter return null; return baseJavaEmitter; } + if (getGLConfig().manuallyImplement(baseJavaEmitter.getName())) { + // User will provide Java-side implementation of this routine + return null; + } return new JavaGLPAWrapperEmitter(baseJavaEmitter, getGLConfig().getProcAddressTableExpr()); } diff --git a/src/net/java/games/jogl/util/BufferUtils.java b/src/net/java/games/jogl/util/BufferUtils.java index aa4653693..05125b75e 100644 --- a/src/net/java/games/jogl/util/BufferUtils.java +++ b/src/net/java/games/jogl/util/BufferUtils.java @@ -69,4 +69,13 @@ public class BufferUtils { dest.put(orig); return dest; } + + /** Creates an "offset buffer" for use with the + ARB_vertex_buffer_object extension. The resulting Buffers are + suitable for use with routines such as glVertexPointer <em>when + used in conjunction with that extension</em>. They have no + capacity and are not suitable for passing to OpenGL routines + that do not support buffer offsets, or to non-OpenGL + routines. */ + public static native ByteBuffer bufferOffset(int offset); } |