Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  JOGL, C, arrays and safety  (Read 883 times)
0 Members and 2 Guests are viewing this topic.
Offline timniblett

JGO n00b
*

Posts: 2


Java games rock!


« on: 2003-09-07 11:25:11 »

I'm using picking & the selection buffer with JOGL.

Here is the native code for glSelectBuffer

JNIEXPORT void JNICALL
Java_net_java_games_jogl_impl_windows_WindowsGLImpl_glSelectBuffer(JNIEnv *env, jobject _unused, jint size, jintArray buffer) {
 GLuint * _ptr1 = NULL;
 if (buffer != NULL) {
   _ptr1 = (GLuint *) (*env)->GetPrimitiveArrayCritical(env, buffer, NULL);
 }
 glSelectBuffer((GLsizei) size, (GLuint *) _ptr1);
 if (buffer != NULL) {
   (*env)->ReleasePrimitiveArrayCritical(env, buffer, _ptr1, JNI_ABORT);
 }
}

I'm concerned that I fill the buffer and query it _after_ this call.  However, there seems to be no guarantee that the JVM hasn't moved the array somewhere or even that it passed a copy over in the first place.

Am I missing something or is it just unsafe?

Tim

Offline Ken Russell

JGO Kernel
*****

Posts: 3446
Medals: 3


Java games rock!


« Reply #1 on: 2003-09-07 15:09:32 »

You're right. I hadn't used selection or feedback before and hadn't realized that those routines need to have only New I/O-based accessors (requiring direct buffers, which don't move in memory). Could you please file a bug on the JOGL Issues page at http://jogl.dev.java.net/ ? Thanks.
Offline timniblett

JGO n00b
*

Posts: 2


Java games rock!


« Reply #2 on: 2003-09-07 16:34:55 »

OK, I've filed a bug report.
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.067 seconds with 20 queries.