diff --git a/make/config/jogl/glx-CustomCCode.c b/make/config/jogl/glx-CustomCCode.c index b4b4f5b..7cbddc8 100644 --- a/make/config/jogl/glx-CustomCCode.c +++ b/make/config/jogl/glx-CustomCCode.c @@ -91,7 +91,7 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXChooseFBConfig(JNIEnv *env, jclass _ * Bug 961: Validate returned 'GLXFBConfig *', i.e. remove NULL pointer. * Note: sizeof(GLXFBConfig) == sizeof(void*), a.k.a a pointer */ - // fprintf(stderr, "glXChooseFBConfig.0: Count %d\n", count); + fprintf(stderr, "before glXChooseFBConfig.0: Count %d\n", count); i=0; while( i < count ) { if( NULL == _res[i] ) { @@ -103,8 +103,8 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXChooseFBConfig(JNIEnv *env, jclass _ i++; } } - // fprintf(stderr, "glXChooseFBConfig.X: Count %d\n", count); - + fprintf(stderr, "after glXChooseFBConfig.X: Count %d\n", count); + fprintf(stderr, "copy bytes %d\n", count * sizeof(GLXFBConfig)); jbyteCopy = JVMUtil_NewDirectByteBufferCopy(env, _res, count * sizeof(GLXFBConfig)); XFree(_res); @@ -132,7 +132,7 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXGetFBConfigs(JNIEnv *env, jclass _un _res = (* ptr_glXGetFBConfigs) ((Display *) (intptr_t) dpy, (int) screen, (int *) _nelements_ptr); count = _nelements_ptr[0]; if (NULL == _res) return NULL; - + fprintf(stderr, "before glXGetFBConfigs.0: Count %d\n", count); /** * Bug 961: Validate returned 'GLXFBConfig *', i.e. remove NULL pointer. * Note: sizeof(GLXFBConfig) == sizeof(void*), a.k.a a pointer @@ -148,7 +148,7 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXGetFBConfigs(JNIEnv *env, jclass _un i++; } } - + fprintf(stderr, "after glXGetFBConfigs.X: Count %d\n", count); jbyteCopy = JVMUtil_NewDirectByteBufferCopy(env, _res, count * sizeof(GLXFBConfig)); XFree(_res); @@ -175,7 +175,7 @@ Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXChooseVisual(JNIEnv *env, jclass _un assert(ptr_glXChooseVisual != NULL); _res = (* ptr_glXChooseVisual) ((Display *) (intptr_t) dpy, (int) screen, (int *) _attribList_ptr); if (NULL == _res) return NULL; - + jbyteCopy = JVMUtil_NewDirectByteBufferCopy(env, _res, sizeof(XVisualInfo)); XFree(_res); diff --git a/make/config/jogl/glx-CustomJavaCode.java b/make/config/jogl/glx-CustomJavaCode.java index 5a3ea39..a24fe5f 100644 --- a/make/config/jogl/glx-CustomJavaCode.java +++ b/make/config/jogl/glx-CustomJavaCode.java @@ -15,6 +15,7 @@ if( attributes.remaining() > values.remaining() ) { throw new RuntimeException("not enough values "+values+" for attributes "+attributes); } + final long __addr = glxProcAddressTable._addressof_glXGetFBConfigAttrib; return dispatch_glXGetFBConfigAttributes(dpy, config, attributes.remaining(), attributes, Buffers.getDirectBufferByteOffset(attributes), values, Buffers.getDirectBufferByteOffset(values), __addr); @@ -50,8 +51,12 @@ if (__addr_ == 0) { throw new GLException("Method \"glXChooseFBConfig\" not available"); } - final ByteBuffer _res = dispatch_glXChooseFBConfig(dpy, screen, attribList, Buffers.getDirectBufferByteOffset(attribList), nitems, Buffers.getDirectBufferByteOffset(nitems), __addr_); + Thread.dumpStack(); + ByteBuffer _res = dispatch_glXChooseFBConfig(dpy, screen, attribList, Buffers.getDirectBufferByteOffset(attribList), nitems, Buffers.getDirectBufferByteOffset(nitems), __addr_); if (_res == null) return null; + System.out.println("_res!=null "+ _res); + System.out.println("native order"+ Buffers.nativeOrder(_res)); + System.out.println("wrap"+ PointerBuffer.wrap(Buffers.nativeOrder(_res))); return PointerBuffer.wrap(Buffers.nativeOrder(_res)); } @@ -90,7 +95,8 @@ if (__addr_ == 0) { throw new GLException("Method \"glXChooseVisual\" not available"); } - final ByteBuffer _res = dispatch_glXChooseVisual(dpy, screen, attribList, Buffers.getDirectBufferByteOffset(attribList), __addr_); + Thread.dumpStack(); + ByteBuffer _res = dispatch_glXChooseVisual(dpy, screen, attribList, Buffers.getDirectBufferByteOffset(attribList), __addr_); if (_res == null) return null; return XVisualInfo.create(Buffers.nativeOrder(_res)); }