From 661fec76c5ccd030016d66675024ec604752ccda Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Wed, 6 Aug 2003 04:58:31 +0000 Subject: Changed behavior of ManuallyImplement to not emit GLEmitter's dispatch routine, but to still emit entry in proc address table. Added first implementation of glMapBufferARB; may need to reimplement due to creation of finalizable direct ByteBuffer objects each time this routine is called (which will be every frame). git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@45 232f8b59-042b-4e1e-8c03-345bb8c30851 --- make/build.xml | 5 +++++ make/gl-common.cfg | 7 +++---- make/gl-impl-CustomCCode.c | 15 +++++++++++++++ make/gl-impl-CustomJavaCode.java | 16 ++++++++++++++++ make/gl-impl-macosx.cfg | 3 +++ make/gl-impl-win32.cfg | 3 +++ make/gl-impl-x11.cfg | 3 +++ 7 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 make/gl-impl-CustomCCode.c create mode 100644 make/gl-impl-CustomJavaCode.java (limited to 'make') diff --git a/make/build.xml b/make/build.xml index 7875f57cc..e3ce6476f 100644 --- a/make/build.xml +++ b/make/build.xml @@ -159,6 +159,8 @@ + + @@ -475,6 +477,9 @@ (the uptodate task doesn't allow arbitrary source and target filesets but should) --> + + + diff --git a/make/gl-common.cfg b/make/gl-common.cfg index 32664d7a0..9f2acf1c2 100644 --- a/make/gl-common.cfg +++ b/make/gl-common.cfg @@ -49,10 +49,9 @@ Ignore glGetVertexAttribPointervARB Ignore glGetVertexAttribPointervNV Ignore glTracePointerRangeMESA -# FIXME: Temporarily ignore glMapBufferARB as it returns a void* that -# we don't know the size of, and it's so new that there's no -# documentation on its semantics -Ignore glMapBufferARB +# Manually implement glMapBufferARB as the size of the returned buffer +# can only be computed by calling another routine +ManuallyImplement glMapBufferARB # Ignore GL functions that have void** parameters; we cannot yet deal with them Ignore glMultiDrawElements diff --git a/make/gl-impl-CustomCCode.c b/make/gl-impl-CustomCCode.c new file mode 100644 index 000000000..1616353d9 --- /dev/null +++ b/make/gl-impl-CustomCCode.c @@ -0,0 +1,15 @@ +/* Java->C glue code: + * Java package: net.java.games.jogl.impl.windows.WindowsGLImpl + * Java method: java.nio.ByteBuffer dispatch_glMapBufferARB(int target, int access) + * C function: LPVOID glMapBufferARB(GLenum target, GLenum access); + */ +JNIEXPORT jobject JNICALL +Java_net_java_games_jogl_impl_windows_WindowsGLImpl_dispatch_1glMapBufferARB(JNIEnv *env, jobject _unused, jint target, jint access, jint size, jlong glProcAddress) { + PFNGLMAPBUFFERARBPROC ptr_glMapBufferARB; + LPVOID _res; + ptr_glMapBufferARB = (PFNGLMAPBUFFERARBPROC) (intptr_t) glProcAddress; + assert(ptr_glMapBufferARB != NULL); + _res = (* ptr_glMapBufferARB) ((GLenum) target, (GLenum) access); + if (_res == NULL) return NULL; + return (*env)->NewDirectByteBuffer(env, _res, size); +} diff --git a/make/gl-impl-CustomJavaCode.java b/make/gl-impl-CustomJavaCode.java new file mode 100644 index 000000000..31bb91bc1 --- /dev/null +++ b/make/gl-impl-CustomJavaCode.java @@ -0,0 +1,16 @@ +/** Entry point to C language function:
LPVOID glMapBufferARB(GLenum target, GLenum access); */ +public java.nio.ByteBuffer glMapBufferARB(int target, int access) { + final long __addr_ = context.getGLProcAddressTable()._addressof_glMapBufferARB; + if (__addr_ == 0) { + throw new GLException("Method \"glMapBufferARB\" not available"); + } + int[] sz = new int[1]; + glGetBufferParameterivARB(target, GL_BUFFER_SIZE_ARB, sz); + ByteBuffer _res; + _res = dispatch_glMapBufferARB(target, access, sz[0], __addr_); + if (_res == null) return null; + return _res.order(ByteOrder.nativeOrder()); +} + +/** Encapsulates function pointer for OpenGL function
: LPVOID glMapBufferARB(GLenum target, GLenum access); */ +native private java.nio.ByteBuffer dispatch_glMapBufferARB(int target, int access, int size, long glProcAddress); diff --git a/make/gl-impl-macosx.cfg b/make/gl-impl-macosx.cfg index 5aa8ea786..c5a0ade2f 100644 --- a/make/gl-impl-macosx.cfg +++ b/make/gl-impl-macosx.cfg @@ -68,3 +68,6 @@ CustomJavaCode MacOSXGLImpl { CustomJavaCode MacOSXGLImpl // FIXME CustomJavaCode MacOSXGLImpl throw new GLException("Not yet implemented"); CustomJavaCode MacOSXGLImpl } + +IncludeAs CustomJavaCode MacOSXGLImpl gl-impl-CustomJavaCode.java +IncludeAs CustomCCode gl-impl-CustomCCode.c diff --git a/make/gl-impl-win32.cfg b/make/gl-impl-win32.cfg index 4891bd490..18c213769 100644 --- a/make/gl-impl-win32.cfg +++ b/make/gl-impl-win32.cfg @@ -57,3 +57,6 @@ CustomJavaCode WindowsGLImpl */ CustomJavaCode WindowsGLImpl public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { CustomJavaCode WindowsGLImpl return wglAllocateMemoryNV(arg0, arg1, arg2, arg3); CustomJavaCode WindowsGLImpl } + +IncludeAs CustomJavaCode WindowsGLImpl gl-impl-CustomJavaCode.java +IncludeAs CustomCCode gl-impl-CustomCCode.c diff --git a/make/gl-impl-x11.cfg b/make/gl-impl-x11.cfg index e94923c64..0ef534df1 100644 --- a/make/gl-impl-x11.cfg +++ b/make/gl-impl-x11.cfg @@ -55,3 +55,6 @@ CustomJavaCode X11GLImpl */ CustomJavaCode X11GLImpl public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) { CustomJavaCode X11GLImpl return glXAllocateMemoryNV(arg0, arg1, arg2, arg3); CustomJavaCode X11GLImpl } + +IncludeAs CustomJavaCode X11GLImpl gl-impl-CustomJavaCode.java +IncludeAs CustomCCode gl-impl-CustomCCode.c -- cgit v1.2.3