diff options
Diffstat (limited to 'make/gl-impl-CustomJavaCode.java')
-rw-r--r-- | make/gl-impl-CustomJavaCode.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/make/gl-impl-CustomJavaCode.java b/make/gl-impl-CustomJavaCode.java index 152458b5b..a4709fde4 100644 --- a/make/gl-impl-CustomJavaCode.java +++ b/make/gl-impl-CustomJavaCode.java @@ -25,6 +25,29 @@ private static class ARBVBOKey { private Map/*<ARBVBOKey, ByteBuffer>*/ arbVBOCache = new HashMap(); +/** Entry point to C language function: <br> <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */ +public java.nio.ByteBuffer glMapBuffer(int target, int access) { + final long __addr_ = _context.getGLProcAddressTable()._addressof_glMapBuffer; + if (__addr_ == 0) { + throw new GLException("Method \"glMapBuffer\" not available"); + } + int[] sz = new int[1]; + glGetBufferParameteriv(target, GL_BUFFER_SIZE_ARB, sz); + long addr; + addr = dispatch_glMapBuffer(target, access, __addr_); + if (addr == 0 || sz[0] == 0) { + return null; + } + ARBVBOKey key = new ARBVBOKey(addr, sz[0]); + ByteBuffer _res = (ByteBuffer) arbVBOCache.get(key); + if (_res == null) { + _res = InternalBufferUtils.newDirectByteBuffer(addr, sz[0]); + _res.order(ByteOrder.nativeOrder()); + arbVBOCache.put(key, _res); + } + return _res; +} + /** Entry point to C language function: <br> <code> LPVOID glMapBufferARB(GLenum target, GLenum access); </code> */ public java.nio.ByteBuffer glMapBufferARB(int target, int access) { final long __addr_ = _context.getGLProcAddressTable()._addressof_glMapBufferARB; @@ -48,5 +71,8 @@ public java.nio.ByteBuffer glMapBufferARB(int target, int access) { return _res; } +/** Encapsulates function pointer for OpenGL function <br>: <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */ +native private long dispatch_glMapBuffer(int target, int access, long glProcAddress); + /** Encapsulates function pointer for OpenGL function <br>: <code> LPVOID glMapBufferARB(GLenum target, GLenum access); </code> */ native private long dispatch_glMapBufferARB(int target, int access, long glProcAddress); |