From e67ea5cc93a476bfbd334fb5def5df5ef4e22885 Mon Sep 17 00:00:00 2001 From: athomas Date: Wed, 19 Nov 2003 01:04:30 +0000 Subject: Simplified alcOpenDeviceNative a little git-svn-id: file:///home/mbien/NetBeansProjects/JOGAMP/joal-sync/git-svn/../svn-server-sync/joal/trunk@61 03bf7f67-59de-4072-a415-9a990d468a3f --- src/native/alcbind.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/native/alcbind.c') diff --git a/src/native/alcbind.c b/src/native/alcbind.c index c598b04..c34e72f 100644 --- a/src/native/alcbind.c +++ b/src/native/alcbind.c @@ -52,19 +52,13 @@ JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_openDeviceNative str = (ALubyte*)(*env)->GetStringUTFChars(env,deviceName,NULL); device = alcOpenDevice(str); printf("In openDeviceNative() test 2a -- %s - %i\n", str, (jint)device); + (*env)->ReleaseStringUTFChars(env,deviceName,str); } else { device = alcOpenDevice(NULL); printf("In openDeviceNative() test 2b -- NULL - %i\n", (jint)device); } - printf("In openDeviceNative() test 3\n"); - if(deviceName != NULL) { - (*env)->ReleaseStringUTFChars(env,deviceName,str); - printf("In openDeviceNative() test 4a\n"); - } else { - printf("In openDeviceNative() test 4b\n"); - } result = (jint)device; - printf("In openDeviceNative() test 5\n"); + printf("In openDeviceNative() test 3\n"); printf("Exiting openDeviceNative()\n"); return result; } @@ -81,10 +75,13 @@ JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_createContextNative ALint* attrList = NULL; if(attrs != NULL) { attrList = (ALint*)(*env)->GetPrimitiveArrayCritical(env,attrs,0); + jint ctxPtr = (jint)alcCreateContext(device,attrList); + (*env)->ReleasePrimitiveArrayCritical(env,attrs,attrList,0); + return ctxPtr; + } else { + jint ctxPtr = (jint)alcCreateContext(device,NULL); + return ctxPtr; } - jint ctxPtr = (jint)alcCreateContext(device,attrList); - (*env)->ReleasePrimitiveArrayCritical(env,attrs,attrList,0); - return ctxPtr; } JNIEXPORT jint JNICALL Java_net_java_games_joal_ALCImpl_makeContextCurrentNative -- cgit v1.2.3