View | Details | Raw Unified | Return to bug 1166
Collapse All | Expand All

(-)a/make/config/jogl/glx-CustomCCode.c (-6 / +6 lines)
Lines 91-97 Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXChooseFBConfig(JNIEnv *env, jclass _ Link Here
91
   * Bug 961: Validate returned 'GLXFBConfig *', i.e. remove NULL pointer. 
91
   * Bug 961: Validate returned 'GLXFBConfig *', i.e. remove NULL pointer. 
92
   * Note: sizeof(GLXFBConfig) == sizeof(void*), a.k.a a pointer
92
   * Note: sizeof(GLXFBConfig) == sizeof(void*), a.k.a a pointer
93
   */
93
   */
94
  // fprintf(stderr, "glXChooseFBConfig.0: Count %d\n", count);
94
  fprintf(stderr, "before glXChooseFBConfig.0: Count %d\n", count);
95
  i=0;
95
  i=0;
96
  while( i < count ) {
96
  while( i < count ) {
97
    if( NULL == _res[i] ) {
97
    if( NULL == _res[i] ) {
Lines 103-110 Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXChooseFBConfig(JNIEnv *env, jclass _ Link Here
103
       i++;
103
       i++;
104
    }
104
    }
105
  }
105
  }
106
  // fprintf(stderr, "glXChooseFBConfig.X: Count %d\n", count);
106
  fprintf(stderr, "after glXChooseFBConfig.X: Count %d\n", count);
107
107
  fprintf(stderr, "copy bytes %d\n", count * sizeof(GLXFBConfig));
108
  jbyteCopy   = JVMUtil_NewDirectByteBufferCopy(env, _res, count * sizeof(GLXFBConfig));
108
  jbyteCopy   = JVMUtil_NewDirectByteBufferCopy(env, _res, count * sizeof(GLXFBConfig));
109
  XFree(_res);
109
  XFree(_res);
110
110
Lines 132-138 Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXGetFBConfigs(JNIEnv *env, jclass _un Link Here
132
  _res = (* ptr_glXGetFBConfigs) ((Display *) (intptr_t) dpy, (int) screen, (int *) _nelements_ptr);
132
  _res = (* ptr_glXGetFBConfigs) ((Display *) (intptr_t) dpy, (int) screen, (int *) _nelements_ptr);
133
  count = _nelements_ptr[0];
133
  count = _nelements_ptr[0];
134
  if (NULL == _res) return NULL;
134
  if (NULL == _res) return NULL;
135
135
  fprintf(stderr, "before glXGetFBConfigs.0: Count %d\n", count);
136
  /**
136
  /**
137
   * Bug 961: Validate returned 'GLXFBConfig *', i.e. remove NULL pointer. 
137
   * Bug 961: Validate returned 'GLXFBConfig *', i.e. remove NULL pointer. 
138
   * Note: sizeof(GLXFBConfig) == sizeof(void*), a.k.a a pointer
138
   * Note: sizeof(GLXFBConfig) == sizeof(void*), a.k.a a pointer
Lines 148-154 Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXGetFBConfigs(JNIEnv *env, jclass _un Link Here
148
       i++;
148
       i++;
149
    }
149
    }
150
  }
150
  }
151
151
  fprintf(stderr, "after glXGetFBConfigs.X: Count %d\n", count);
152
  jbyteCopy   = JVMUtil_NewDirectByteBufferCopy(env, _res, count * sizeof(GLXFBConfig));
152
  jbyteCopy   = JVMUtil_NewDirectByteBufferCopy(env, _res, count * sizeof(GLXFBConfig));
153
  XFree(_res);
153
  XFree(_res);
154
154
Lines 175-181 Java_jogamp_opengl_x11_glx_GLX_dispatch_1glXChooseVisual(JNIEnv *env, jclass _un Link Here
175
  assert(ptr_glXChooseVisual != NULL);
175
  assert(ptr_glXChooseVisual != NULL);
176
  _res = (* ptr_glXChooseVisual) ((Display *) (intptr_t) dpy, (int) screen, (int *) _attribList_ptr);
176
  _res = (* ptr_glXChooseVisual) ((Display *) (intptr_t) dpy, (int) screen, (int *) _attribList_ptr);
177
  if (NULL == _res) return NULL;
177
  if (NULL == _res) return NULL;
178
178
  
179
  jbyteCopy   = JVMUtil_NewDirectByteBufferCopy(env, _res, sizeof(XVisualInfo));
179
  jbyteCopy   = JVMUtil_NewDirectByteBufferCopy(env, _res, sizeof(XVisualInfo));
180
  XFree(_res);
180
  XFree(_res);
181
181
(-)a/make/config/jogl/glx-CustomJavaCode.java (-2 / +8 lines)
Lines 15-20 Link Here
15
    if( attributes.remaining() > values.remaining() ) {
15
    if( attributes.remaining() > values.remaining() ) {
16
        throw new RuntimeException("not enough values "+values+" for attributes "+attributes);
16
        throw new RuntimeException("not enough values "+values+" for attributes "+attributes);
17
    }
17
    }
18
    
18
    final long __addr = glxProcAddressTable._addressof_glXGetFBConfigAttrib;
19
    final long __addr = glxProcAddressTable._addressof_glXGetFBConfigAttrib;
19
    return dispatch_glXGetFBConfigAttributes(dpy, config, attributes.remaining(), attributes, Buffers.getDirectBufferByteOffset(attributes), 
20
    return dispatch_glXGetFBConfigAttributes(dpy, config, attributes.remaining(), attributes, Buffers.getDirectBufferByteOffset(attributes), 
20
                                             values, Buffers.getDirectBufferByteOffset(values), __addr);
21
                                             values, Buffers.getDirectBufferByteOffset(values), __addr);
Lines 50-57 Link Here
50
    if (__addr_ == 0) {
51
    if (__addr_ == 0) {
51
      throw new GLException("Method \"glXChooseFBConfig\" not available");
52
      throw new GLException("Method \"glXChooseFBConfig\" not available");
52
    }
53
    }
53
    final ByteBuffer _res = dispatch_glXChooseFBConfig(dpy, screen, attribList, Buffers.getDirectBufferByteOffset(attribList), nitems, Buffers.getDirectBufferByteOffset(nitems), __addr_);
54
    Thread.dumpStack();
55
    ByteBuffer _res = dispatch_glXChooseFBConfig(dpy, screen, attribList, Buffers.getDirectBufferByteOffset(attribList), nitems, Buffers.getDirectBufferByteOffset(nitems), __addr_);
54
    if (_res == null) return null;
56
    if (_res == null) return null;
57
    System.out.println("_res!=null "+ _res);
58
    System.out.println("native order"+ Buffers.nativeOrder(_res));
59
    System.out.println("wrap"+ PointerBuffer.wrap(Buffers.nativeOrder(_res)));
55
    return PointerBuffer.wrap(Buffers.nativeOrder(_res));
60
    return PointerBuffer.wrap(Buffers.nativeOrder(_res));
56
  }
61
  }
57
62
Lines 90-96 Link Here
90
    if (__addr_ == 0) {
95
    if (__addr_ == 0) {
91
      throw new GLException("Method \"glXChooseVisual\" not available");
96
      throw new GLException("Method \"glXChooseVisual\" not available");
92
    }
97
    }
93
    final ByteBuffer _res = dispatch_glXChooseVisual(dpy, screen, attribList, Buffers.getDirectBufferByteOffset(attribList), __addr_);
98
    Thread.dumpStack();
99
    ByteBuffer _res = dispatch_glXChooseVisual(dpy, screen, attribList, Buffers.getDirectBufferByteOffset(attribList), __addr_);
94
    if (_res == null) return null;
100
    if (_res == null) return null;
95
    return XVisualInfo.create(Buffers.nativeOrder(_res));
101
    return XVisualInfo.create(Buffers.nativeOrder(_res));
96
  }
102
  }

Return to bug 1166