From: <ma...@us...> - 2006-04-30 21:15:27
|
Revision: 2313 Author: matzon Date: 2006-04-30 14:15:14 -0700 (Sun, 30 Apr 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2313&view=rev Log Message: ----------- updated version to 1.0 Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/Sys.java trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java trunk/LWJGL/src/native/common/common_tools.c trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-04-30 21:09:16 UTC (rev 2312) +++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-04-30 21:15:14 UTC (rev 2313) @@ -51,7 +51,7 @@ public final class Sys { /** Current version of library */ - private static final String VERSION = "0.99"; + private static final String VERSION = "1.0"; /** The implementation instance to delegate platform specific behavior to */ private final static SysImplementation implementation; Modified: trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java 2006-04-30 21:09:16 UTC (rev 2312) +++ trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java 2006-04-30 21:15:14 UTC (rev 2313) @@ -199,7 +199,7 @@ private static String FMOD_OSX_LIBRARY_NAME = "fmod"; /** Version of FMOD */ - public static final String VERSION = "0.99"; + public static final String VERSION = "1.0"; static { initialize(); Modified: trunk/LWJGL/src/native/common/common_tools.c =================================================================== --- trunk/LWJGL/src/native/common/common_tools.c 2006-04-30 21:09:16 UTC (rev 2312) +++ trunk/LWJGL/src/native/common/common_tools.c 2006-04-30 21:15:14 UTC (rev 2313) @@ -48,7 +48,7 @@ #include "org_lwjgl_DefaultSysImplementation.h" static bool debug = false; -static const char* VERSION = "0.99"; +static const char* VERSION = "1.0"; static JavaVM *jvm; void initAttribList(attrib_list_t *list) { Modified: trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c =================================================================== --- trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c 2006-04-30 21:09:16 UTC (rev 2312) +++ trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c 2006-04-30 21:15:14 UTC (rev 2313) @@ -33,7 +33,7 @@ #include "org_lwjgl_fmod3_FMOD.h" #include "extfmod3.h" -static const char* VERSION = "0.99"; +static const char* VERSION = "1.0"; /* * Class: org_lwjgl_fmod3_FMOD This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2006-05-14 21:55:03
|
Revision: 2327 Author: matzon Date: 2006-05-14 14:54:48 -0700 (Sun, 14 May 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2327&view=rev Log Message: ----------- 1.0beta version string Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/Sys.java trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java trunk/LWJGL/src/native/common/common_tools.c trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-05-14 14:18:13 UTC (rev 2326) +++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-05-14 21:54:48 UTC (rev 2327) @@ -51,7 +51,7 @@ public final class Sys { /** Current version of library */ - private static final String VERSION = "1.0"; + private static final String VERSION = "1.0beta"; /** The implementation instance to delegate platform specific behavior to */ private final static SysImplementation implementation; Modified: trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java 2006-05-14 14:18:13 UTC (rev 2326) +++ trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java 2006-05-14 21:54:48 UTC (rev 2327) @@ -199,7 +199,7 @@ private static String FMOD_OSX_LIBRARY_NAME = "fmod"; /** Version of FMOD */ - public static final String VERSION = "1.0"; + public static final String VERSION = "1.0beta"; static { initialize(); Modified: trunk/LWJGL/src/native/common/common_tools.c =================================================================== --- trunk/LWJGL/src/native/common/common_tools.c 2006-05-14 14:18:13 UTC (rev 2326) +++ trunk/LWJGL/src/native/common/common_tools.c 2006-05-14 21:54:48 UTC (rev 2327) @@ -48,7 +48,7 @@ #include "org_lwjgl_DefaultSysImplementation.h" static bool debug = false; -static const char* VERSION = "1.0"; +static const char* VERSION = "1.0beta"; static JavaVM *jvm; void initAttribList(attrib_list_t *list) { Modified: trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c =================================================================== --- trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c 2006-05-14 14:18:13 UTC (rev 2326) +++ trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c 2006-05-14 21:54:48 UTC (rev 2327) @@ -33,7 +33,7 @@ #include "org_lwjgl_fmod3_FMOD.h" #include "extfmod3.h" -static const char* VERSION = "1.0"; +static const char* VERSION = "1.0beta"; /* * Class: org_lwjgl_fmod3_FMOD This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2007-04-19 22:20:16
|
Revision: 2773 http://svn.sourceforge.net/java-game-lib/?rev=2773&view=rev Author: matzon Date: 2007-04-19 15:20:14 -0700 (Thu, 19 Apr 2007) Log Message: ----------- openal 1.1 exposing device and context Added Paths: ----------- trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c Added: trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c =================================================================== --- trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c (rev 0) +++ trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c 2007-04-19 22:20:14 UTC (rev 2773) @@ -0,0 +1,342 @@ +/* + * Copyright (c) 2002-2004 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id: org_lwjgl_openal_ALC.c 2279 2006-02-23 19:22:00Z elias_naur $ + * + * This is the actual JNI implementation of the OpenAL context/device library. + * + * @author Brian Matzon <br...@ma...> + * @version $Revision: 2279 $ + */ + +/* OpenAL includes */ +#include "extal.h" + +//alc +typedef ALCubyte* (ALCAPIENTRY *alcGetStringPROC)(ALCdevice *device,ALCenum param); +typedef ALCvoid (ALCAPIENTRY *alcGetIntegervPROC)(ALCdevice *device,ALCenum param,ALCsizei size,ALCint *data); +typedef ALCdevice* (ALCAPIENTRY *alcOpenDevicePROC)(ALCubyte *deviceName); +typedef ALCboolean (ALCAPIENTRY *alcCloseDevicePROC)(ALCdevice *device); +typedef ALCcontext* (ALCAPIENTRY *alcCreateContextPROC)(ALCdevice *device,ALCint *attrList); +typedef ALCenum (ALCAPIENTRY *alcMakeContextCurrentPROC)(ALCcontext *context); +typedef ALCvoid (ALCAPIENTRY *alcProcessContextPROC)(ALCcontext *context); +typedef ALCdevice* (ALCAPIENTRY *alcGetContextsDevicePROC)(ALCcontext *context); +typedef ALCvoid (ALCAPIENTRY *alcSuspendContextPROC)(ALCcontext *context); +typedef ALCvoid (ALCAPIENTRY *alcDestroyContextPROC)(ALCcontext *context); +typedef ALCenum (ALCAPIENTRY *alcGetErrorPROC)(ALCdevice *device); +typedef ALCboolean (ALCAPIENTRY *alcIsExtensionPresentPROC)(ALCdevice *device,ALCubyte *extName); +//typedef ALCvoid* (ALCAPIENTRY *alcGetProcAddressPROC)(ALCdevice *device,ALCubyte *funcName); +typedef ALCenum (ALCAPIENTRY *alcGetEnumValuePROC)(ALCdevice *device,ALCubyte *enumName); +typedef ALCcontext* (ALCAPIENTRY *alcGetCurrentContextPROC)(ALCvoid); + +static alcGetCurrentContextPROC alcGetCurrentContext = NULL; +static alcGetStringPROC alcGetString; +static alcGetIntegervPROC alcGetIntegerv; +static alcOpenDevicePROC alcOpenDevice; +static alcCloseDevicePROC alcCloseDevice; +static alcCreateContextPROC alcCreateContext; +static alcMakeContextCurrentPROC alcMakeContextCurrent; +static alcProcessContextPROC alcProcessContext; +static alcGetContextsDevicePROC alcGetContextsDevice; +static alcSuspendContextPROC alcSuspendContext; +static alcDestroyContextPROC alcDestroyContext; +static alcGetErrorPROC alcGetError; +static alcIsExtensionPresentPROC alcIsExtensionPresent; +//static alcGetProcAddressPROC alcGetProcAddress; +static alcGetEnumValuePROC alcGetEnumValue; + +/** + * This function returns strings related to the context. + * + * C Specification: + * ALubyte * alcGetString(ALCdevice *device, ALenum token); + */ +static jstring JNICALL Java_org_lwjgl_openal_ALC10_nalcGetString (JNIEnv *env, jclass clazz, jlong deviceaddress, jint token) { + const char* alcString = (const char*) alcGetString((ALCdevice*)((intptr_t)deviceaddress), (ALenum) token); + int length; + int i=1; + + if(alcString == NULL) { + return NULL; + } + + // Special treatment of enumeration tokens + // These are encoded using \0 between elements and a finishing \0\0 + switch(token) { + case 0x1005: // ALC_DEVICE_SPECIFIER + case 0x310: // ALC_CAPTURE_DEVICE_SPECIFIER + while (alcString[i - 1] != '\0' || alcString[i] != '\0') { + i++; + } + length = i + 1; + break; + default: + length = strlen(alcString); + } + return NewStringNativeWithLength(env, alcString, length); +} + +/** + * This function returns integers related to the context. + * + * C Specification: + * ALvoid alcGetIntegerv(ALCdevice *device, ALenum token, ALsizei size, ALint *dest); + */ +static void JNICALL Java_org_lwjgl_openal_ALC10_nalcGetIntegerv (JNIEnv *env, jclass clazz, jlong deviceaddress, jint token, jint size, jobject dest, jint offset) { + ALint* address = NULL; + if (dest != NULL) { + address = offset + (ALint*) (*env)->GetDirectBufferAddress(env, dest); + } + alcGetIntegerv((ALCdevice*)((intptr_t)deviceaddress), (ALenum) token, (ALsizei) size, address); +} + +/** + * This function opens a device by name. + * + * C Specification: + * ALCdevice *alcOpenDevice( const ALubyte *tokstr ); + */ +static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcOpenDevice (JNIEnv *env, jclass clazz, jstring tokstr) { + char * tokenstring; + ALCdevice* device; + + if(tokstr != NULL) { + tokenstring = GetStringNativeChars(env, tokstr); + } else { + tokenstring = NULL; + } + + /* get device */ + device = alcOpenDevice((ALubyte *) tokenstring); + + /* if error - cleanup and get out */ + if(device == NULL) { + if(tokenstring != NULL) { + free(tokenstring); + } + return (jlong) NULL; + } + + /* clean up */ + if (tokenstring != NULL) + free(tokenstring); + + return (jlong)((intptr_t)device); +} + +/** + * This function closes a device by name. + * + * C Specification: + * bool alcCloseDevice( ALCdevice *dev ); + */ +static jboolean JNICALL Java_org_lwjgl_openal_ALC10_nalcCloseDevice (JNIEnv *env, jclass clazz, jlong deviceaddress) { + return alcCloseDevice((ALCdevice*)((intptr_t)deviceaddress)); +} + +/** + * This function creates a context using a specified device. + * + * C Specification: + * ALCcontext* alcCreateContext( ALCdevice *dev, ALint* attrlist ); + */ +static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcCreateContext (JNIEnv *env, jclass clazz, jlong deviceaddress, jobject attrlist) { + ALint* address = NULL; + ALCcontext* context; + + if (attrlist != NULL) { + address = (ALint*) safeGetBufferAddress(env, attrlist); + } + context = alcCreateContext((ALCdevice*)((intptr_t)deviceaddress), address); + + /* if error - get out */ + if(context == NULL) { + return (jlong) NULL; + } + + return (jlong)((intptr_t)context); +} + +/** + * This function makes a specified context the current context. + * + * C Specification: + * ALCboolean alcMakeContextCurrent(ALCcontext *context); + */ +static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcMakeContextCurrent (JNIEnv *env, jclass clazz, jlong contextaddress) { + ALCcontext* context = (ALCcontext*)((intptr_t)contextaddress); + ALCenum result; + if(context == NULL) { + result = alcMakeContextCurrent(NULL); + } else { + result = alcMakeContextCurrent(context); + } + return result; +} + +/** + * This function tells a context to begin processing. + * + * C Specification: + * void alcProcessContext(ALCcontext *context); + */ +static void JNICALL Java_org_lwjgl_openal_ALC10_nalcProcessContext (JNIEnv *env, jclass clazz, jlong contextaddress) { + alcProcessContext((ALCcontext*)((intptr_t)contextaddress)); +} + +/** + * This function retrieves the current context. + * + * C Specification: + * ALCcontext* alcGetCurrentContext( ALvoid ); + */ +static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcGetCurrentContext (JNIEnv *env, jclass clazz) { + ALCcontext* context = alcGetCurrentContext(); + + if(context == NULL) { + return (jlong) NULL; + } + return (jlong)((intptr_t)context); +} + +/** + * This function retrieves the specified contexts device + * + * C Specification: + * ALCdevice* alcGetContextsDevice(ALCcontext *context); + */ +static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcGetContextsDevice (JNIEnv *env, jclass clazz, jlong contextaddress) { + ALCdevice* device = alcGetContextsDevice((ALCcontext*)((intptr_t)contextaddress)); + + if(device == NULL) { + return (jlong) NULL; + } + + return (jlong)((intptr_t)device); +} + +/** + * This function suspends processing on a specified context. + * + * C Specification: + * void alcSuspendContext(ALCcontext *context); + */ +static void JNICALL Java_org_lwjgl_openal_ALC10_nalcSuspendContext (JNIEnv *env, jclass clazz, jlong contextaddress) { + alcSuspendContext((ALCcontext*)((intptr_t)contextaddress)); +} + +/** + * This function destroys a context. + * + * C Specification: + * void alcDestroyContext(ALCcontext *context); + */ +static void JNICALL Java_org_lwjgl_openal_ALC10_nalcDestroyContext (JNIEnv *env, jclass clazz, jlong contextaddress) { + alcDestroyContext((ALCcontext*)((intptr_t)contextaddress)); +} + +/** + * This function retrieves the specified devices context error state. + * + * C Specification: + * ALCenum alcGetError(ALCdevice *device); + */ +static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcGetError (JNIEnv *env, jclass clazz, jlong deviceaddress) { + return alcGetError((ALCdevice*)((intptr_t)deviceaddress)); +} + +/** + * This function queries if a specified context extension is available. + * + * C Specification: + * ALboolean alcIsExtensionPresent(ALCdevice *device, ALubyte *extName); + */ +static jboolean JNICALL Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent (JNIEnv *env, jclass clazz, jlong deviceaddress, jstring extName) { + /* get extension */ + ALubyte* functionname = (ALubyte*) GetStringNativeChars(env, extName); + + jboolean result = (jboolean) alcIsExtensionPresent((ALCdevice*)((intptr_t)deviceaddress), functionname); + + free(functionname); + + return result; +} + +/** + * This function retrieves the enum value for a specified enumeration name. + * + * C Specification: + * ALenum alcGetEnumValue(ALCdevice *device, ALubyte *enumName); + */ +static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcGetEnumValue (JNIEnv *env, jclass clazz, jlong deviceaddress, jstring enumName) { + /* get extension */ + ALubyte* enumerationname = (ALubyte*) GetStringNativeChars(env, enumName); + + jint result = (jint) alcGetEnumValue((ALCdevice*)((intptr_t)deviceaddress), enumerationname); + + free(enumerationname); + + return result; +} + +/** + * Loads the context OpenAL functions + * + * @return true if all methods were loaded, false if one of the methods could not be loaded + */ +#ifdef __cplusplus +extern "C" { +#endif +JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC10_initNativeStubs(JNIEnv *env, jclass clazz) { + JavaMethodAndExtFunction functions[] = { + {"nalcGetString", "(JI)Ljava/lang/String;", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetString, "alcGetString", (void*)&alcGetString}, + {"nalcGetIntegerv", "(JIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetIntegerv, "alcGetIntegerv", (void*)&alcGetIntegerv}, + {"nalcOpenDevice", "(Ljava/lang/String;)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcOpenDevice, "alcOpenDevice", (void*)&alcOpenDevice}, + {"nalcCloseDevice", "(J)Z", (void*)&Java_org_lwjgl_openal_ALC10_nalcCloseDevice, "alcCloseDevice", (void*)&alcCloseDevice}, + {"nalcCreateContext", "(JLjava/nio/IntBuffer;)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcCreateContext, "alcCreateContext", (void*)&alcCreateContext}, + {"nalcMakeContextCurrent", "(J)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcMakeContextCurrent, "alcMakeContextCurrent", (void*)&alcMakeContextCurrent}, + {"nalcProcessContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcProcessContext, "alcProcessContext", (void*)&alcProcessContext}, + {"nalcGetCurrentContext", "()J", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetCurrentContext, "alcGetCurrentContext", (void*)&alcGetCurrentContext}, + {"nalcGetContextsDevice", "(J)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetContextsDevice, "alcGetContextsDevice", (void*)&alcGetContextsDevice}, + {"nalcSuspendContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcSuspendContext, "alcSuspendContext", (void*)&alcSuspendContext}, + {"nalcDestroyContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcDestroyContext, "alcDestroyContext", (void*)&alcDestroyContext}, + {"nalcGetError", "(J)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetError, "alcGetError", (void*)&alcGetError}, + {"nalcIsExtensionPresent", "(JLjava/lang/String;)Z", (void*)&Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent, "alcIsExtensionPresent", (void*)&alcIsExtensionPresent}, + {"nalcGetEnumValue", "(JLjava/lang/String;)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetEnumValue, "alcGetEnumValue", (void*)&alcGetEnumValue} + }; + int num_functions = NUMFUNCTIONS(functions); + extal_InitializeClass(env, clazz, num_functions, functions); +} +#ifdef __cplusplus +} +#endif Added: trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c =================================================================== --- trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c (rev 0) +++ trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c 2007-04-19 22:20:14 UTC (rev 2773) @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2002-2004 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * $Id: org_lwjgl_openal_ALC.c 2279 2006-02-23 19:22:00Z elias_naur $ + * + * This is the actual JNI implementation of the OpenAL context/device library. + * + * @author Brian Matzon <br...@ma...> + * @version $Revision: 2279 $ + */ + +/* OpenAL includes */ +#include "extal.h" + +//alc +typedef ALCdevice * (ALCAPIENTRY *alcCaptureOpenDevicePROC)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize ); +typedef ALCboolean (ALCAPIENTRY *alcCaptureCloseDevicePROC)( ALCdevice *device ); +typedef void (ALCAPIENTRY *alcCaptureStartPROC)( ALCdevice *device ); +typedef void (ALCAPIENTRY *alcCaptureStopPROC)( ALCdevice *device ); +typedef void (ALCAPIENTRY *alcCaptureSamplesPROC)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples ); + +static alcCaptureOpenDevicePROC alcCaptureOpenDevice; +static alcCaptureCloseDevicePROC alcCaptureCloseDevice; +static alcCaptureStartPROC alcCaptureStart; +static alcCaptureStopPROC alcCaptureStop; +static alcCaptureSamplesPROC alcCaptureSamples; + +/* + * Class: org_lwjgl_openal_ALC11 + * Method: nalcCaptureOpenDevice + * Signature: (Ljava/lang/String;III)J + */ +static jlong JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureOpenDevice(JNIEnv *env, jclass clazz, jstring devicename, jint frequency, jint format, jint buffersize) { + ALubyte* dev_name = NULL; + ALCdevice* device = NULL; + + if(devicename != NULL) { + dev_name = (ALubyte*) GetStringNativeChars(env, devicename); + } + + device = alcCaptureOpenDevice(dev_name, frequency, format, buffersize); + + free(dev_name); + return (jlong) device; +} + +/* + * Class: org_lwjgl_openal_ALC11 + * Method: nalcCaptureCloseDevice + * Signature: (J)Z + */ +static jboolean JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureCloseDevice(JNIEnv *env, jclass clazz, jlong device) { + return (jboolean) alcCaptureCloseDevice((ALCdevice*) device); +} + +/* + * Class: org_lwjgl_openal_ALC11 + * Method: nalcCaptureStart + * Signature: (J)V + */ +static void JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureStart(JNIEnv *env, jclass clazz, jlong device) { + alcCaptureStart((ALCdevice*) device); +} + +/* + * Class: org_lwjgl_openal_ALC11 + * Method: nalcCaptureStop + * Signature: (J)V + */ +static void JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureStop(JNIEnv * env, jclass clazz, jlong device) { + alcCaptureStop((ALCdevice*) device); +} + +/* + * Class: org_lwjgl_openal_ALC11 + * Method: nalcCaptureSamples + * Signature: (JLjava/nio/ByteBuffer;I)V + */ +static void JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureSamples(JNIEnv *env, jclass clazz, jlong device, jobject buffer, jint position, jint samples) { + ALuint *buffer_address = ((ALuint *)(*env)->GetDirectBufferAddress(env, buffer)) + position; + alcCaptureSamples((ALCdevice*) device, buffer_address, samples); +} + +/** + * Loads the context OpenAL functions + * + * @return true if all methods were loaded, false if one of the methods could not be loaded + */ +#ifdef __cplusplus +extern "C" { +#endif +JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC11_initNativeStubs(JNIEnv *env, jclass clazz) { + JavaMethodAndExtFunction functions[] = { + {"nalcCaptureOpenDevice", "(Ljava/lang/String;III)J", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureOpenDevice, "alcCaptureOpenDevice", (void*)&alcCaptureOpenDevice}, + {"nalcCaptureCloseDevice", "(J)Z", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureCloseDevice, "alcCaptureCloseDevice", (void*)&alcCaptureCloseDevice}, + {"nalcCaptureStart", "(J)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureStart, "alcCaptureStart", (void*)&alcCaptureStart}, + {"nalcCaptureStop", "(J)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureStop, "alcCaptureStop", (void*)&alcCaptureStop}, + {"nalcCaptureSamples", "(JLjava/nio/ByteBuffer;II)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureSamples, "alcCaptureSamples", (void*)&alcCaptureSamples} + }; + int num_functions = NUMFUNCTIONS(functions); + extal_InitializeClass(env, clazz, num_functions, functions); +} +#ifdef __cplusplus +} +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2007-04-19 22:34:02
|
Revision: 2772 http://svn.sourceforge.net/java-game-lib/?rev=2772&view=rev Author: matzon Date: 2007-04-19 15:18:16 -0700 (Thu, 19 Apr 2007) Log Message: ----------- using NewStringNativeWithLength Modified Paths: -------------- trunk/LWJGL/src/native/common/common_tools.c trunk/LWJGL/src/native/common/common_tools.h Modified: trunk/LWJGL/src/native/common/common_tools.c =================================================================== --- trunk/LWJGL/src/native/common/common_tools.c 2007-04-19 12:00:40 UTC (rev 2771) +++ trunk/LWJGL/src/native/common/common_tools.c 2007-04-19 22:18:16 UTC (rev 2772) @@ -195,11 +195,11 @@ * match GLuchar and ALuchar types */ jstring NewStringNativeUnsigned(JNIEnv *env, const unsigned char *str) { - return NewStringNative(env, (const char *)str); + return NewStringNativeWithLength(env, (const char *)str, strlen((const char *)str)); } // creates locale specific string -jstring NewStringNative(JNIEnv *env, const char *str) { +jstring NewStringNativeWithLength(JNIEnv *env, const char *str, int length) { jclass jcls_str; jmethodID jmethod_str; jstring result; @@ -221,10 +221,10 @@ if ((*env)->EnsureLocalCapacity(env,2) < 0) { return NULL; /* out of memory error */ } - len = strlen(str); - bytes = (*env)->NewByteArray(env,len); + + bytes = (*env)->NewByteArray(env,length); if (bytes != NULL) { - (*env)->SetByteArrayRegion(env,bytes, 0, len, (jbyte *)str); + (*env)->SetByteArrayRegion(env,bytes, 0, length, (jbyte *)str); result = (jstring)(*env)->NewObject(env,jcls_str, jmethod_str, bytes); (*env)->DeleteLocalRef(env,bytes); return result; @@ -289,7 +289,7 @@ } bool getBooleanProperty(JNIEnv *env, const char* propertyName) { - jstring property = NewStringNative(env, propertyName); + jstring property = NewStringNativeWithLength(env, propertyName, strlen(propertyName)); jclass org_lwjgl_LWJGLUtil_class; jmethodID getBoolean; if (property == NULL) Modified: trunk/LWJGL/src/native/common/common_tools.h =================================================================== --- trunk/LWJGL/src/native/common/common_tools.h 2007-04-19 12:00:40 UTC (rev 2771) +++ trunk/LWJGL/src/native/common/common_tools.h 2007-04-19 22:18:16 UTC (rev 2772) @@ -138,7 +138,7 @@ extern void printfDebug(const char *format, ...); extern bool getBooleanProperty(JNIEnv *env, const char* propertyName); extern char * GetStringNativeChars(JNIEnv *env, jstring jstr); -extern jstring NewStringNative(JNIEnv *env, const char *str); +extern jstring NewStringNativeWithLength(JNIEnv *env, const char *str, int length); extern jstring NewStringNativeUnsigned(JNIEnv *env, const unsigned char *str); extern jobject newJavaManagedByteBuffer(JNIEnv *env, const int size); extern bool positionBuffer(JNIEnv *env, jobject buffer, jint position); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sp...@us...> - 2006-05-25 13:04:58
|
Revision: 2340 Author: spasi Date: 2006-05-25 06:03:35 -0700 (Thu, 25 May 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2340&view=rev Log Message: ----------- Added EXT_timer_query extension Added support for long (int64) types Modified Paths: -------------- trunk/LWJGL/src/generated/org/lwjgl/opengl/ARBOcclusionQuery.java trunk/LWJGL/src/generated/org/lwjgl/opengl/ATITextFragmentShader.java trunk/LWJGL/src/generated/org/lwjgl/opengl/ContextCapabilities.java trunk/LWJGL/src/generated/org/lwjgl/opengl/GL15.java trunk/LWJGL/src/generated/org/lwjgl/opengl/NVOcclusionQuery.java trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java trunk/LWJGL/src/java/org/lwjgl/BufferUtils.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/PostfixTranslator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeInfo.java trunk/LWJGL/src/native/common/extgl.h trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_text_fragment_shader.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_occlusion_query.java Added Paths: ----------- trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTTimerQuery.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GLint64EXT.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GLuint64EXT.java trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTTimerQuery.c trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_timer_query.java Modified: trunk/LWJGL/src/generated/org/lwjgl/opengl/ARBOcclusionQuery.java =================================================================== --- trunk/LWJGL/src/generated/org/lwjgl/opengl/ARBOcclusionQuery.java 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/generated/org/lwjgl/opengl/ARBOcclusionQuery.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -69,7 +69,7 @@ public static void glGetQueryARB(int target, int pname, IntBuffer params) { long function_pointer = GLContext.getCapabilities().ARB_occlusion_query_glGetQueryivARB_pointer; BufferChecks.checkFunctionAddress(function_pointer); - BufferChecks.checkBuffer(params, 4); + BufferChecks.checkBuffer(params, 1); nglGetQueryivARB(target, pname, params, params.position(), function_pointer); } private static native void nglGetQueryivARB(int target, int pname, IntBuffer params, int params_position, long function_pointer); @@ -77,7 +77,7 @@ public static void glGetQueryObjectARB(int id, int pname, IntBuffer params) { long function_pointer = GLContext.getCapabilities().ARB_occlusion_query_glGetQueryObjectivARB_pointer; BufferChecks.checkFunctionAddress(function_pointer); - BufferChecks.checkBuffer(params, 4); + BufferChecks.checkBuffer(params, 1); nglGetQueryObjectivARB(id, pname, params, params.position(), function_pointer); } private static native void nglGetQueryObjectivARB(int id, int pname, IntBuffer params, int params_position, long function_pointer); @@ -85,7 +85,7 @@ public static void glGetQueryObjectuARB(int id, int pname, IntBuffer params) { long function_pointer = GLContext.getCapabilities().ARB_occlusion_query_glGetQueryObjectuivARB_pointer; BufferChecks.checkFunctionAddress(function_pointer); - BufferChecks.checkBuffer(params, 4); + BufferChecks.checkBuffer(params, 1); nglGetQueryObjectuivARB(id, pname, params, params.position(), function_pointer); } private static native void nglGetQueryObjectuivARB(int id, int pname, IntBuffer params, int params_position, long function_pointer); Modified: trunk/LWJGL/src/generated/org/lwjgl/opengl/ATITextFragmentShader.java =================================================================== --- trunk/LWJGL/src/generated/org/lwjgl/opengl/ATITextFragmentShader.java 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/generated/org/lwjgl/opengl/ATITextFragmentShader.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -8,9 +8,9 @@ public final class ATITextFragmentShader { /** - * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, - * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, - * and GetDoublev, and by the <target> parameter of ProgramStringARB, + * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, + * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, + * and GetDoublev, and by the <target> parameter of ProgramStringARB, * BindProgramARB, ProgramEnvParameter4{d,dv,f,fv}ARB, * ProgramLocalParameter4{d,dv,f,fv}ARB, * GetProgramEnvParameter{dv,fv}ARB, GetProgramLocalParameter{dv,fv}ARB, Modified: trunk/LWJGL/src/generated/org/lwjgl/opengl/ContextCapabilities.java =================================================================== --- trunk/LWJGL/src/generated/org/lwjgl/opengl/ContextCapabilities.java 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/generated/org/lwjgl/opengl/ContextCapabilities.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -98,6 +98,7 @@ public final boolean GL_EXT_texture_mirror_clamp; public final boolean GL_EXT_texture_rectangle; public final boolean GL_EXT_texture_sRGB; + public final boolean GL_EXT_timer_query; public final boolean GL_EXT_vertex_shader; public final boolean GL_EXT_vertex_weighting; public final boolean OpenGL11; @@ -460,6 +461,8 @@ long EXT_secondary_color_glSecondaryColorPointerEXT_pointer; long EXT_stencil_clear_tag_glStencilClearTagEXT_pointer; long EXT_stencil_two_side_glActiveStencilFaceEXT_pointer; + long EXT_timer_query_glGetQueryObjecti64vEXT_pointer; + long EXT_timer_query_glGetQueryObjectui64vEXT_pointer; long EXT_vertex_shader_glBeginVertexShaderEXT_pointer; long EXT_vertex_shader_glEndVertexShaderEXT_pointer; long EXT_vertex_shader_glBindVertexShaderEXT_pointer; @@ -1477,6 +1480,12 @@ (EXT_stencil_two_side_glActiveStencilFaceEXT_pointer = GLContext.getFunctionAddress("glActiveStencilFaceEXT")) != 0; } + private boolean EXT_timer_query_initNativeFunctionAddresses() { + return + (EXT_timer_query_glGetQueryObjecti64vEXT_pointer = GLContext.getFunctionAddress("glGetQueryObjecti64vEXT")) != 0 && + (EXT_timer_query_glGetQueryObjectui64vEXT_pointer = GLContext.getFunctionAddress("glGetQueryObjectui64vEXT")) != 0; + } + private boolean EXT_vertex_shader_initNativeFunctionAddresses() { return (EXT_vertex_shader_glBeginVertexShaderEXT_pointer = GLContext.getFunctionAddress("glBeginVertexShaderEXT")) != 0 && @@ -2198,6 +2207,8 @@ supported_extensions.remove("GL_EXT_stencil_clear_tag"); if (supported_extensions.contains("GL_EXT_stencil_two_side") && !EXT_stencil_two_side_initNativeFunctionAddresses()) supported_extensions.remove("GL_EXT_stencil_two_side"); + if (supported_extensions.contains("GL_EXT_timer_query") && !EXT_timer_query_initNativeFunctionAddresses()) + supported_extensions.remove("GL_EXT_timer_query"); if (supported_extensions.contains("GL_EXT_vertex_shader") && !EXT_vertex_shader_initNativeFunctionAddresses()) supported_extensions.remove("GL_EXT_vertex_shader"); if (supported_extensions.contains("GL_EXT_vertex_weighting") && !EXT_vertex_weighting_initNativeFunctionAddresses()) @@ -2339,6 +2350,7 @@ this.GL_EXT_texture_mirror_clamp = supported_extensions.contains("GL_EXT_texture_mirror_clamp"); this.GL_EXT_texture_rectangle = supported_extensions.contains("GL_EXT_texture_rectangle"); this.GL_EXT_texture_sRGB = supported_extensions.contains("GL_EXT_texture_sRGB"); + this.GL_EXT_timer_query = supported_extensions.contains("GL_EXT_timer_query"); this.GL_EXT_vertex_shader = supported_extensions.contains("GL_EXT_vertex_shader"); this.GL_EXT_vertex_weighting = supported_extensions.contains("GL_EXT_vertex_weighting"); this.OpenGL11 = supported_extensions.contains("OpenGL11"); Added: trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTTimerQuery.java =================================================================== --- trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTTimerQuery.java (rev 0) +++ trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTTimerQuery.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -0,0 +1,35 @@ +/* MACHINE GENERATED FILE, DO NOT EDIT */ + +package org.lwjgl.opengl; + +import org.lwjgl.LWJGLException; +import org.lwjgl.BufferChecks; +import java.nio.*; + +public final class EXTTimerQuery { + /** + * Accepted by the <target> parameter of BeginQuery, EndQuery, and + * GetQueryiv: + */ + public static final int GL_TIME_ELAPSED_EXT = 0x88bf; + + private EXTTimerQuery() { + } + + + public static void glGetQueryObjecti64EXT(int id, int pname, LongBuffer params) { + long function_pointer = GLContext.getCapabilities().EXT_timer_query_glGetQueryObjecti64vEXT_pointer; + BufferChecks.checkFunctionAddress(function_pointer); + BufferChecks.checkBuffer(params, 1); + nglGetQueryObjecti64vEXT(id, pname, params, params.position(), function_pointer); + } + private static native void nglGetQueryObjecti64vEXT(int id, int pname, LongBuffer params, int params_position, long function_pointer); + + public static void glGetQueryObjectui64EXT(int id, int pname, LongBuffer params) { + long function_pointer = GLContext.getCapabilities().EXT_timer_query_glGetQueryObjectui64vEXT_pointer; + BufferChecks.checkFunctionAddress(function_pointer); + BufferChecks.checkBuffer(params, 1); + nglGetQueryObjectui64vEXT(id, pname, params, params.position(), function_pointer); + } + private static native void nglGetQueryObjectui64vEXT(int id, int pname, LongBuffer params, int params_position, long function_pointer); +} Modified: trunk/LWJGL/src/generated/org/lwjgl/opengl/GL15.java =================================================================== --- trunk/LWJGL/src/generated/org/lwjgl/opengl/GL15.java 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/generated/org/lwjgl/opengl/GL15.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -279,7 +279,7 @@ public static void glGetQuery(int target, int pname, IntBuffer params) { long function_pointer = GLContext.getCapabilities().GL15_glGetQueryiv_pointer; BufferChecks.checkFunctionAddress(function_pointer); - BufferChecks.checkBuffer(params, 4); + BufferChecks.checkBuffer(params, 1); nglGetQueryiv(target, pname, params, params.position(), function_pointer); } private static native void nglGetQueryiv(int target, int pname, IntBuffer params, int params_position, long function_pointer); @@ -287,7 +287,7 @@ public static void glGetQueryObject(int id, int pname, IntBuffer params) { long function_pointer = GLContext.getCapabilities().GL15_glGetQueryObjectiv_pointer; BufferChecks.checkFunctionAddress(function_pointer); - BufferChecks.checkBuffer(params, 4); + BufferChecks.checkBuffer(params, 1); nglGetQueryObjectiv(id, pname, params, params.position(), function_pointer); } private static native void nglGetQueryObjectiv(int id, int pname, IntBuffer params, int params_position, long function_pointer); @@ -295,7 +295,7 @@ public static void glGetQueryObjectu(int id, int pname, IntBuffer params) { long function_pointer = GLContext.getCapabilities().GL15_glGetQueryObjectuiv_pointer; BufferChecks.checkFunctionAddress(function_pointer); - BufferChecks.checkBuffer(params, 4); + BufferChecks.checkBuffer(params, 1); nglGetQueryObjectuiv(id, pname, params, params.position(), function_pointer); } private static native void nglGetQueryObjectuiv(int id, int pname, IntBuffer params, int params_position, long function_pointer); Modified: trunk/LWJGL/src/generated/org/lwjgl/opengl/NVOcclusionQuery.java =================================================================== --- trunk/LWJGL/src/generated/org/lwjgl/opengl/NVOcclusionQuery.java 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/generated/org/lwjgl/opengl/NVOcclusionQuery.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -59,7 +59,7 @@ public static void glGetOcclusionQueryuNV(int id, int pname, IntBuffer params) { long function_pointer = GLContext.getCapabilities().NV_occlusion_query_glGetOcclusionQueryuivNV_pointer; BufferChecks.checkFunctionAddress(function_pointer); - BufferChecks.checkBuffer(params, 4); + BufferChecks.checkBuffer(params, 1); nglGetOcclusionQueryuivNV(id, pname, params, params.position(), function_pointer); } private static native void nglGetOcclusionQueryuivNV(int id, int pname, IntBuffer params, int params_position, long function_pointer); @@ -67,7 +67,7 @@ public static void glGetOcclusionQueryNV(int id, int pname, IntBuffer params) { long function_pointer = GLContext.getCapabilities().NV_occlusion_query_glGetOcclusionQueryivNV_pointer; BufferChecks.checkFunctionAddress(function_pointer); - BufferChecks.checkBuffer(params, 4); + BufferChecks.checkBuffer(params, 1); nglGetOcclusionQueryivNV(id, pname, params, params.position(), function_pointer); } private static native void nglGetOcclusionQueryivNV(int id, int pname, IntBuffer params, int params_position, long function_pointer); Modified: trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -37,6 +37,7 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; +import java.nio.LongBuffer; /** * <p>A class to check buffer boundaries in general. If there is unsufficient space @@ -46,7 +47,7 @@ * @author cix_foo <ci...@us...> * @author elias_naur <eli...@us...> * @version $Revision$ - * $Id$ + * $Id$ */ public class BufferChecks { /** Static methods only! */ @@ -80,7 +81,7 @@ if (o == null) throw new IllegalArgumentException("Null argument"); } - + /** * Helper methods to ensure a buffer is direct or null. */ @@ -90,24 +91,30 @@ } } - public static void checkDirectOrNull(FloatBuffer buf) { + public static void checkDirectOrNull(ShortBuffer buf) { if (buf != null) { checkDirect(buf); } } - public static void checkDirectOrNull(ShortBuffer buf) { + public static void checkDirectOrNull(IntBuffer buf) { if (buf != null) { checkDirect(buf); } } - public static void checkDirectOrNull(IntBuffer buf) { + public static void checkDirectOrNull(LongBuffer buf) { if (buf != null) { checkDirect(buf); } } + public static void checkDirectOrNull(FloatBuffer buf) { + if (buf != null) { + checkDirect(buf); + } + } + public static void checkDirectOrNull(DoubleBuffer buf) { if (buf != null) { checkDirect(buf); @@ -118,14 +125,16 @@ * Helper methods to ensure a buffer is direct (and, implicitly, non-null). */ public static void checkDirectBuffer(Buffer buf) { - if (buf instanceof ByteBuffer) + if (buf instanceof FloatBuffer) + checkDirect((FloatBuffer)buf); + else if (buf instanceof ByteBuffer) checkDirect((ByteBuffer)buf); else if (buf instanceof ShortBuffer) checkDirect((ShortBuffer)buf); else if (buf instanceof IntBuffer) checkDirect((IntBuffer)buf); - else if (buf instanceof FloatBuffer) - checkDirect((FloatBuffer)buf); + else if (buf instanceof LongBuffer) + checkDirect((LongBuffer)buf); else if (buf instanceof DoubleBuffer) checkDirect((DoubleBuffer)buf); else @@ -138,12 +147,6 @@ } } - public static void checkDirect(FloatBuffer buf) { - if (!buf.isDirect()) { - throw new IllegalArgumentException("FloatBuffer is not direct"); - } - } - public static void checkDirect(ShortBuffer buf) { if (!buf.isDirect()) { throw new IllegalArgumentException("ShortBuffer is not direct"); @@ -156,9 +159,21 @@ } } + public static void checkDirect(LongBuffer buf) { + if (!buf.isDirect()) { + throw new IllegalArgumentException("LongBuffer is not direct"); + } + } + + public static void checkDirect(FloatBuffer buf) { + if (!buf.isDirect()) { + throw new IllegalArgumentException("FloatBuffer is not direct"); + } + } + public static void checkDirect(DoubleBuffer buf) { if (!buf.isDirect()) { - throw new IllegalArgumentException("IntBuffer is not direct"); + throw new IllegalArgumentException("DoubleBuffer is not direct"); } } @@ -183,12 +198,17 @@ checkDirect(buf); } + public static void checkBuffer(ShortBuffer buf, int size) { + checkBufferSize(buf, size); + checkDirect(buf); + } + public static void checkBuffer(IntBuffer buf, int size) { checkBufferSize(buf, size); checkDirect(buf); } - public static void checkBuffer(ShortBuffer buf, int size) { + public static void checkBuffer(LongBuffer buf, int size) { checkBufferSize(buf, size); checkDirect(buf); } @@ -221,14 +241,18 @@ checkBuffer(buf, DEFAULT_BUFFER_SIZE); } - public static void checkBuffer(FloatBuffer buf) { + public static void checkBuffer(IntBuffer buf) { checkBuffer(buf, DEFAULT_BUFFER_SIZE); } - public static void checkBuffer(IntBuffer buf) { + public static void checkBuffer(LongBuffer buf) { checkBuffer(buf, DEFAULT_BUFFER_SIZE); } + public static void checkBuffer(FloatBuffer buf) { + checkBuffer(buf, DEFAULT_BUFFER_SIZE); + } + public static void checkBuffer(DoubleBuffer buf) { checkBuffer(buf, DEFAULT_BUFFER_SIZE); } Modified: trunk/LWJGL/src/java/org/lwjgl/BufferUtils.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/BufferUtils.java 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/java/org/lwjgl/BufferUtils.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -1,31 +1,31 @@ -/* +/* * Copyright (c) 2002-2004 LWJGL Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -50,16 +50,16 @@ */ public final class BufferUtils { - + /** * Construct a direct native-ordered bytebuffer with the specified size. * @param size The size, in bytes * @return a ByteBuffer - */ + */ public static ByteBuffer createByteBuffer(int size) { return ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder()); } - + /** * Construct a direct native-order shortbuffer with the specified number * of elements. @@ -81,6 +81,16 @@ } /** + * Construct a direct native-order intbuffer with the specified number + * of elements. + * @param size The size, in ints + * @return an IntBuffer + */ + public static LongBuffer createLongBuffer(int size) { + return createByteBuffer(size << 3).asLongBuffer(); + } + + /** * Construct a direct native-order floatbuffer with the specified number * of elements. * @param size The size, in floats @@ -91,6 +101,16 @@ } /** + * Construct a direct native-order doublebuffer with the specified number + * of elements. + * @param size The size, in floats + * @return a FloatBuffer + */ + public static DoubleBuffer createDoubleBuffer(int size) { + return createByteBuffer(size << 3).asDoubleBuffer(); + } + + /** * @return n, where buffer_element_size=2^n. */ public static int getElementSizeExponent(Buffer buf) { @@ -107,16 +127,6 @@ } /** - * Construct a direct native-order doublebuffer with the specified number - * of elements. - * @param size The size, in floats - * @return a FloatBuffer - */ - public static DoubleBuffer createDoubleBuffer(int size) { - return createByteBuffer(size << 3).asDoubleBuffer(); - } - - /** * A helper function which is used to get the byte offset in an arbitrary buffer * based on its position * @return the position of the buffer, in BYTES Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -76,6 +76,8 @@ native_types_to_primitive.put(GLsizeiptrARB.class, PrimitiveType.Kind.LONG); native_types_to_primitive.put(GLubyte.class, PrimitiveType.Kind.BYTE); native_types_to_primitive.put(GLvoid.class, PrimitiveType.Kind.BYTE); + native_types_to_primitive.put(GLint64EXT.class, PrimitiveType.Kind.LONG); + native_types_to_primitive.put(GLuint64EXT.class, PrimitiveType.Kind.LONG); } public PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class native_type) { @@ -106,6 +108,10 @@ return Signedness.UNSIGNED; else if (GLbyte.class.equals(type)) return Signedness.SIGNED; + else if (GLuint64EXT.class.equals(type)) + return Signedness.UNSIGNED; + else if (GLint64EXT.class.equals(type)) + return Signedness.SIGNED; else return Signedness.NONE; } @@ -129,6 +135,10 @@ return "d"; else if (annotation_type.equals(GLhalf.class)) return "h"; + else if (annotation_type.equals(GLuint64EXT.class)) + return "l"; + else if (annotation_type.equals(GLint64EXT.class)) + return "l"; else if (annotation_type.equals(GLboolean.class) || annotation_type.equals(GLvoid.class)) return ""; else @@ -153,6 +163,9 @@ case BYTE: type = GLbyte.class; break; + case LONG: + type = GLint64EXT.class; + break; case BOOLEAN: type = GLboolean.class; break; @@ -182,13 +195,15 @@ return new Class[]{GLhalf.class, GLshort.class, GLushort.class}; else if (type.equals(DoubleBuffer.class)) return new Class[]{GLclampd.class, GLdouble.class}; + else if (type.equals(LongBuffer.class)) + return new Class[]{GLint64EXT.class, GLuint64EXT.class}; else return new Class[]{}; } private static Class[] getValidPrimitiveTypes(Class type) { - if (type.equals(long .class)) - return new Class[]{GLintptrARB.class, GLuint.class, GLintptr.class, GLsizeiptrARB.class, GLsizeiptr.class}; + if (type.equals(long.class)) + return new Class[]{GLintptrARB.class, GLuint.class, GLintptr.class, GLsizeiptrARB.class, GLsizeiptr.class, GLint64EXT.class, GLuint64EXT.class}; else if (type.equals(int.class)) return new Class[]{GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class, GLuint.class, GLsizei.class}; @@ -242,6 +257,10 @@ return GLbyte.class; else if (GLbyte.class.equals(type)) return GLubyte.class; + else if (GLuint64EXT.class.equals(type)) + return GLint64EXT.class; + else if (GLint64EXT.class.equals(type)) + return GLuint64EXT.class; else return null; } Added: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLint64EXT.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLint64EXT.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLint64EXT.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2002-2004 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.generator; + +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; + +@NativeType +@Target({ElementType.PARAMETER, ElementType.METHOD}) +public @interface GLint64EXT { +} \ No newline at end of file Added: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLuint64EXT.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLuint64EXT.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLuint64EXT.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2002-2004 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.util.generator; + +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; + +@NativeType +@Target({ElementType.PARAMETER, ElementType.METHOD}) +public @interface GLuint64EXT { +} \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeTypeTranslator.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -106,6 +106,8 @@ return PrimitiveType.Kind.BYTE; else if (FloatBuffer.class.equals(c)) return PrimitiveType.Kind.FLOAT; + else if (LongBuffer.class.equals(c)) + return PrimitiveType.Kind.LONG; else throw new RuntimeException(c + " is not allowed"); } @@ -183,7 +185,7 @@ public void visitReferenceType(ReferenceType t) { throw new RuntimeException(t + " is not allowed"); } - + public void visitTypeMirror(TypeMirror t) { throw new RuntimeException(t + " is not allowed"); } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/PostfixTranslator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/PostfixTranslator.java 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/PostfixTranslator.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -81,6 +81,8 @@ return PrimitiveType.Kind.BYTE; else if (FloatBuffer.class.equals(c)) return PrimitiveType.Kind.FLOAT; + else if (LongBuffer.class.equals(c)) + return PrimitiveType.Kind.LONG; else throw new RuntimeException(c + " is not allowed"); } @@ -150,6 +152,9 @@ case BYTE: type = "b"; break; + case LONG: + type = "l"; + break; default: throw new RuntimeException(kind + " is not allowed"); } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeInfo.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeInfo.java 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeInfo.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -116,6 +116,9 @@ case SHORT: type = ShortBuffer.class; break; + case LONG: + type = LongBuffer.class; + break; case BYTE: /* fall through */ case BOOLEAN: type = ByteBuffer.class; Modified: trunk/LWJGL/src/native/common/extgl.h =================================================================== --- trunk/LWJGL/src/native/common/extgl.h 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/native/common/extgl.h 2006-05-25 13:03:35 UTC (rev 2340) @@ -107,37 +107,37 @@ /* OpenGL 1.1 definition */ #ifdef _MACOSX -typedef unsigned long GLenum; -typedef unsigned char GLboolean; -typedef unsigned long GLbitfield; -typedef signed char GLbyte; -typedef short GLshort; -typedef long GLint; -typedef long GLsizei; -typedef unsigned char GLubyte; -typedef unsigned short GLushort; -typedef unsigned long GLuint; -typedef float GLfloat; -typedef float GLclampf; -typedef double GLdouble; -typedef double GLclampd; -typedef void GLvoid; + typedef unsigned long GLenum; + typedef unsigned char GLboolean; + typedef unsigned long GLbitfield; + typedef signed char GLbyte; + typedef short GLshort; + typedef long GLint; + typedef long GLsizei; + typedef unsigned char GLubyte; + typedef unsigned short GLushort; + typedef unsigned long GLuint; + typedef float GLfloat; + typedef float GLclampf; + typedef double GLdouble; + typedef double GLclampd; + typedef void GLvoid; #else -typedef unsigned int GLenum; -typedef unsigned char GLboolean; -typedef unsigned int GLbitfield; -typedef signed char GLbyte; -typedef short GLshort; -typedef int GLint; -typedef int GLsizei; -typedef unsigned char GLubyte; -typedef unsigned short GLushort; -typedef unsigned int GLuint; -typedef float GLfloat; -typedef float GLclampf; -typedef double GLdouble; -typedef double GLclampd; -typedef void GLvoid; + typedef unsigned int GLenum; + typedef unsigned char GLboolean; + typedef unsigned int GLbitfield; + typedef signed char GLbyte; + typedef short GLshort; + typedef int GLint; + typedef int GLsizei; + typedef unsigned char GLubyte; + typedef unsigned short GLushort; + typedef unsigned int GLuint; + typedef float GLfloat; + typedef float GLclampf; + typedef double GLdouble; + typedef double GLclampd; + typedef void GLvoid; #endif // OpenGL 2.0 types @@ -155,6 +155,10 @@ // NV_half_float types typedef unsigned short GLhalf; +// EXT_timer_query types +typedef unsigned long GLuint64EXT; +typedef long GLint64EXT; + /* helper stuff */ /* initializes everything, call this right after the rc is created. the function returns true if successful */ Added: trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTTimerQuery.c =================================================================== --- trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTTimerQuery.c (rev 0) +++ trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTTimerQuery.c 2006-05-25 13:03:35 UTC (rev 2340) @@ -0,0 +1,20 @@ +/* MACHINE GENERATED FILE, DO NOT EDIT */ + +#include <jni.h> +#include "extgl.h" + +typedef void (APIENTRY *glGetQueryObjecti64vEXTPROC) (GLuint id, GLenum pname, GLint64EXT * params); +typedef void (APIENTRY *glGetQueryObjectui64vEXTPROC) (GLuint id, GLenum pname, GLuint64EXT * params); + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTTimerQuery_nglGetQueryObjecti64vEXT(JNIEnv *env, jclass clazz, jint id, jint pname, jobject params, jint params_position, jlong function_pointer) { + GLint64EXT *params_address = ((GLint64EXT *)(*env)->GetDirectBufferAddress(env, params)) + params_position; + glGetQueryObjecti64vEXTPROC glGetQueryObjecti64vEXT = (glGetQueryObjecti64vEXTPROC)((intptr_t)function_pointer); + glGetQueryObjecti64vEXT(id, pname, params_address); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTTimerQuery_nglGetQueryObjectui64vEXT(JNIEnv *env, jclass clazz, jint id, jint pname, jobject params, jint params_position, jlong function_pointer) { + GLuint64EXT *params_address = ((GLuint64EXT *)(*env)->GetDirectBufferAddress(env, params)) + params_position; + glGetQueryObjectui64vEXTPROC glGetQueryObjectui64vEXT = (glGetQueryObjectui64vEXTPROC)((intptr_t)function_pointer); + glGetQueryObjectui64vEXT(id, pname, params_address); +} + Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -67,11 +67,11 @@ void glEndQueryARB(@GLenum int target); @StripPostfix("params") - void glGetQueryivARB(@GLenum int target, @GLenum int pname, @Check("4") IntBuffer params); + void glGetQueryivARB(@GLenum int target, @GLenum int pname, @Check("1") IntBuffer params); @StripPostfix("params") - void glGetQueryObjectivARB(@GLuint int id, @GLenum int pname, @Check("4") IntBuffer params); + void glGetQueryObjectivARB(@GLuint int id, @GLenum int pname, @Check("1") IntBuffer params); @StripPostfix("params") - void glGetQueryObjectuivARB(@GLuint int id, @GLenum int pname, @Check("4") IntBuffer params); -} + void glGetQueryObjectuivARB(@GLuint int id, @GLenum int pname, @Check("1") IntBuffer params); +} \ No newline at end of file Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_text_fragment_shader.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_text_fragment_shader.java 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_text_fragment_shader.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -34,9 +34,9 @@ public interface ATI_text_fragment_shader { /** - * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, - * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, - * and GetDoublev, and by the <target> parameter of ProgramStringARB, + * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, + * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, + * and GetDoublev, and by the <target> parameter of ProgramStringARB, * BindProgramARB, ProgramEnvParameter4{d,dv,f,fv}ARB, * ProgramLocalParameter4{d,dv,f,fv}ARB, * GetProgramEnvParameter{dv,fv}ARB, GetProgramLocalParameter{dv,fv}ARB, Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_timer_query.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_timer_query.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_timer_query.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2002-2004 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; + +import java.nio.*; + +public interface EXT_timer_query { + + /** + * Accepted by the <target> parameter of BeginQuery, EndQuery, and + * GetQueryiv: + */ + int GL_TIME_ELAPSED_EXT = 0x88BF; + + @StripPostfix("params") + void glGetQueryObjecti64vEXT(@GLuint int id, @GLenum int pname, @Check("1") @GLint64EXT LongBuffer params); + + @StripPostfix("params") + void glGetQueryObjectui64vEXT(@GLuint int id, @GLenum int pname, @Check("1") @GLuint64EXT LongBuffer params); + +} \ No newline at end of file Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -167,11 +167,11 @@ void glEndQuery(@GLenum int target); @StripPostfix("params") - void glGetQueryiv(@GLenum int target, @GLenum int pname, @Check("4") IntBuffer params); + void glGetQueryiv(@GLenum int target, @GLenum int pname, @Check("1") IntBuffer params); @StripPostfix("params") - void glGetQueryObjectiv(@GLenum int id, @GLenum int pname, @Check("4") @GLint IntBuffer params); + void glGetQueryObjectiv(@GLenum int id, @GLenum int pname, @Check("1") @GLint IntBuffer params); @StripPostfix("params") - void glGetQueryObjectuiv(@GLenum int id, @GLenum int pname, @Check("4") @GLuint IntBuffer params); + void glGetQueryObjectuiv(@GLenum int id, @GLenum int pname, @Check("1") @GLuint IntBuffer params); } Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_occlusion_query.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_occlusion_query.java 2006-05-18 12:11:37 UTC (rev 2339) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_occlusion_query.java 2006-05-25 13:03:35 UTC (rev 2340) @@ -55,8 +55,8 @@ void glEndOcclusionQueryNV(); @StripPostfix("params") - void glGetOcclusionQueryuivNV(@GLuint int id, @GLenum int pname, @Check("4") @GLuint IntBuffer params); + void glGetOcclusionQueryuivNV(@GLuint int id, @GLenum int pname, @Check("1") @GLuint IntBuffer params); @StripPostfix("params") - void glGetOcclusionQueryivNV(@GLuint int id, @GLenum int pname, @Check("4") IntBuffer params); + void glGetOcclusionQueryivNV(@GLuint int id, @GLenum int pname, @Check("1") IntBuffer params); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eli...@us...> - 2006-07-07 10:37:12
|
Revision: 2449 Author: elias_naur Date: 2006-07-07 03:36:26 -0700 (Fri, 07 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2449&view=rev Log Message: ----------- Added a native NewStringNativeUnsigned to avoid compile warnings Modified Paths: -------------- trunk/LWJGL/src/generated/org/lwjgl/opengl/ATITextFragmentShader.java trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTTimerQuery.java trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java trunk/LWJGL/src/native/common/common_tools.c trunk/LWJGL/src/native/common/common_tools.h trunk/LWJGL/src/native/generated/org_lwjgl_openal_AL10.c trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTTimerQuery.c trunk/LWJGL/src/native/generated/org_lwjgl_opengl_GL11.c Modified: trunk/LWJGL/src/generated/org/lwjgl/opengl/ATITextFragmentShader.java =================================================================== --- trunk/LWJGL/src/generated/org/lwjgl/opengl/ATITextFragmentShader.java 2006-07-05 10:47:15 UTC (rev 2448) +++ trunk/LWJGL/src/generated/org/lwjgl/opengl/ATITextFragmentShader.java 2006-07-07 10:36:26 UTC (rev 2449) @@ -1,24 +1,24 @@ -/* MACHINE GENERATED FILE, DO NOT EDIT */ - -package org.lwjgl.opengl; - -import org.lwjgl.LWJGLException; -import org.lwjgl.BufferChecks; -import java.nio.*; - -public final class ATITextFragmentShader { - /** - * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, - * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, - * and GetDoublev, and by the <target> parameter of ProgramStringARB, - * BindProgramARB, ProgramEnvParameter4{d,dv,f,fv}ARB, - * ProgramLocalParameter4{d,dv,f,fv}ARB, - * GetProgramEnvParameter{dv,fv}ARB, GetProgramLocalParameter{dv,fv}ARB, - * GetProgramivARB, GetProgramfvATI, and GetProgramStringARB. - */ - public static final int GL_TEXT_FRAGMENT_SHADER_ATI = 0x8200; - - private ATITextFragmentShader() { - } - -} +/* MACHINE GENERATED FILE, DO NOT EDIT */ + +package org.lwjgl.opengl; + +import org.lwjgl.LWJGLException; +import org.lwjgl.BufferChecks; +import java.nio.*; + +public final class ATITextFragmentShader { + /** + * Accepted by the <cap> parameter of Disable, Enable, and IsEnabled, + * and by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, + * and GetDoublev, and by the <target> parameter of ProgramStringARB, + * BindProgramARB, ProgramEnvParameter4{d,dv,f,fv}ARB, + * ProgramLocalParameter4{d,dv,f,fv}ARB, + * GetProgramEnvParameter{dv,fv}ARB, GetProgramLocalParameter{dv,fv}ARB, + * GetProgramivARB, GetProgramfvATI, and GetProgramStringARB. + */ + public static final int GL_TEXT_FRAGMENT_SHADER_ATI = 0x8200; + + private ATITextFragmentShader() { + } + +} Modified: trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTTimerQuery.java =================================================================== --- trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTTimerQuery.java 2006-07-05 10:47:15 UTC (rev 2448) +++ trunk/LWJGL/src/generated/org/lwjgl/opengl/EXTTimerQuery.java 2006-07-07 10:36:26 UTC (rev 2449) @@ -1,35 +1,35 @@ -/* MACHINE GENERATED FILE, DO NOT EDIT */ - -package org.lwjgl.opengl; - -import org.lwjgl.LWJGLException; -import org.lwjgl.BufferChecks; -import java.nio.*; - -public final class EXTTimerQuery { - /** - * Accepted by the <target> parameter of BeginQuery, EndQuery, and - * GetQueryiv: - */ - public static final int GL_TIME_ELAPSED_EXT = 0x88bf; - - private EXTTimerQuery() { - } - - - public static void glGetQueryObjecti64EXT(int id, int pname, LongBuffer params) { - long function_pointer = GLContext.getCapabilities().EXT_timer_query_glGetQueryObjecti64vEXT_pointer; - BufferChecks.checkFunctionAddress(function_pointer); - BufferChecks.checkBuffer(params, 1); - nglGetQueryObjecti64vEXT(id, pname, params, params.position(), function_pointer); - } - private static native void nglGetQueryObjecti64vEXT(int id, int pname, LongBuffer params, int params_position, long function_pointer); - - public static void glGetQueryObjectui64EXT(int id, int pname, LongBuffer params) { - long function_pointer = GLContext.getCapabilities().EXT_timer_query_glGetQueryObjectui64vEXT_pointer; - BufferChecks.checkFunctionAddress(function_pointer); - BufferChecks.checkBuffer(params, 1); - nglGetQueryObjectui64vEXT(id, pname, params, params.position(), function_pointer); - } - private static native void nglGetQueryObjectui64vEXT(int id, int pname, LongBuffer params, int params_position, long function_pointer); -} +/* MACHINE GENERATED FILE, DO NOT EDIT */ + +package org.lwjgl.opengl; + +import org.lwjgl.LWJGLException; +import org.lwjgl.BufferChecks; +import java.nio.*; + +public final class EXTTimerQuery { + /** + * Accepted by the <target> parameter of BeginQuery, EndQuery, and + * GetQueryiv: + */ + public static final int GL_TIME_ELAPSED_EXT = 0x88bf; + + private EXTTimerQuery() { + } + + + public static void glGetQueryObjectEXT(int id, int pname, LongBuffer params) { + long function_pointer = GLContext.getCapabilities().EXT_timer_query_glGetQueryObjecti64vEXT_pointer; + BufferChecks.checkFunctionAddress(function_pointer); + BufferChecks.checkBuffer(params, 1); + nglGetQueryObjecti64vEXT(id, pname, params, params.position(), function_pointer); + } + private static native void nglGetQueryObjecti64vEXT(int id, int pname, LongBuffer params, int params_position, long function_pointer); + + public static void glGetQueryObjectuEXT(int id, int pname, LongBuffer params) { + long function_pointer = GLContext.getCapabilities().EXT_timer_query_glGetQueryObjectui64vEXT_pointer; + BufferChecks.checkFunctionAddress(function_pointer); + BufferChecks.checkBuffer(params, 1); + nglGetQueryObjectui64vEXT(id, pname, params, params.position(), function_pointer); + } + private static native void nglGetQueryObjectui64vEXT(int id, int pname, LongBuffer params, int params_position, long function_pointer); +} Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2006-07-05 10:47:15 UTC (rev 2448) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2006-07-07 10:36:26 UTC (rev 2449) @@ -141,7 +141,7 @@ else writer.print("safeNewBuffer(env, "); } else if (String.class.equals(java_result_type)) - writer.print("NewStringNative(env, "); + writer.print("NewStringNativeUnsigned(env, "); writer.print(Utils.RESULT_VAR_NAME); if (Buffer.class.isAssignableFrom(java_result_type)) { writer.print(", "); Modified: trunk/LWJGL/src/native/common/common_tools.c =================================================================== --- trunk/LWJGL/src/native/common/common_tools.c 2006-07-05 10:47:15 UTC (rev 2448) +++ trunk/LWJGL/src/native/common/common_tools.c 2006-07-07 10:36:26 UTC (rev 2449) @@ -197,6 +197,13 @@ return (char*) result; } +/* creates locale specific string, unsigned argument to + * match GLuchar and ALuchar types + */ +jstring NewStringNativeUnsigned(JNIEnv *env, const unsigned char *str) { + return NewStringNative(env, (const char *)str); +} + // creates locale specific string jstring NewStringNative(JNIEnv *env, const char *str) { jclass jcls_str; Modified: trunk/LWJGL/src/native/common/common_tools.h =================================================================== --- trunk/LWJGL/src/native/common/common_tools.h 2006-07-05 10:47:15 UTC (rev 2448) +++ trunk/LWJGL/src/native/common/common_tools.h 2006-07-07 10:36:26 UTC (rev 2449) @@ -137,6 +137,7 @@ extern bool getBooleanProperty(JNIEnv *env, const char* propertyName); extern char * GetStringNativeChars(JNIEnv *env, jstring jstr); extern jstring NewStringNative(JNIEnv *env, const char *str); +extern jstring NewStringNativeUnsigned(JNIEnv *env, const unsigned char *str); extern jobject newJavaManagedByteBuffer(JNIEnv *env, const int size); extern bool positionBuffer(JNIEnv *env, jobject buffer, jint position); Modified: trunk/LWJGL/src/native/generated/org_lwjgl_openal_AL10.c =================================================================== --- trunk/LWJGL/src/native/generated/org_lwjgl_openal_AL10.c 2006-07-05 10:47:15 UTC (rev 2448) +++ trunk/LWJGL/src/native/generated/org_lwjgl_openal_AL10.c 2006-07-07 10:36:26 UTC (rev 2449) @@ -155,7 +155,7 @@ static jobject JNICALL Java_org_lwjgl_openal_AL10_alGetString(JNIEnv *env, jclass clazz, jint pname) { ALubyte * __result = alGetString(pname); - return NewStringNative(env, __result); + return NewStringNativeUnsigned(env, __result); } static jint JNICALL Java_org_lwjgl_openal_AL10_alGetError(JNIEnv *env, jclass clazz) { Modified: trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTTimerQuery.c =================================================================== --- trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTTimerQuery.c 2006-07-05 10:47:15 UTC (rev 2448) +++ trunk/LWJGL/src/native/generated/org_lwjgl_opengl_EXTTimerQuery.c 2006-07-07 10:36:26 UTC (rev 2449) @@ -1,20 +1,20 @@ -/* MACHINE GENERATED FILE, DO NOT EDIT */ - -#include <jni.h> -#include "extgl.h" - -typedef void (APIENTRY *glGetQueryObjecti64vEXTPROC) (GLuint id, GLenum pname, GLint64EXT * params); -typedef void (APIENTRY *glGetQueryObjectui64vEXTPROC) (GLuint id, GLenum pname, GLuint64EXT * params); - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTTimerQuery_nglGetQueryObjecti64vEXT(JNIEnv *env, jclass clazz, jint id, jint pname, jobject params, jint params_position, jlong function_pointer) { - GLint64EXT *params_address = ((GLint64EXT *)(*env)->GetDirectBufferAddress(env, params)) + params_position; - glGetQueryObjecti64vEXTPROC glGetQueryObjecti64vEXT = (glGetQueryObjecti64vEXTPROC)((intptr_t)function_pointer); - glGetQueryObjecti64vEXT(id, pname, params_address); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTTimerQuery_nglGetQueryObjectui64vEXT(JNIEnv *env, jclass clazz, jint id, jint pname, jobject params, jint params_position, jlong function_pointer) { - GLuint64EXT *params_address = ((GLuint64EXT *)(*env)->GetDirectBufferAddress(env, params)) + params_position; - glGetQueryObjectui64vEXTPROC glGetQueryObjectui64vEXT = (glGetQueryObjectui64vEXTPROC)((intptr_t)function_pointer); - glGetQueryObjectui64vEXT(id, pname, params_address); -} - +/* MACHINE GENERATED FILE, DO NOT EDIT */ + +#include <jni.h> +#include "extgl.h" + +typedef void (APIENTRY *glGetQueryObjecti64vEXTPROC) (GLuint id, GLenum pname, GLint64EXT * params); +typedef void (APIENTRY *glGetQueryObjectui64vEXTPROC) (GLuint id, GLenum pname, GLuint64EXT * params); + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTTimerQuery_nglGetQueryObjecti64vEXT(JNIEnv *env, jclass clazz, jint id, jint pname, jobject params, jint params_position, jlong function_pointer) { + GLint64EXT *params_address = ((GLint64EXT *)(*env)->GetDirectBufferAddress(env, params)) + params_position; + glGetQueryObjecti64vEXTPROC glGetQueryObjecti64vEXT = (glGetQueryObjecti64vEXTPROC)((intptr_t)function_pointer); + glGetQueryObjecti64vEXT(id, pname, params_address); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_EXTTimerQuery_nglGetQueryObjectui64vEXT(JNIEnv *env, jclass clazz, jint id, jint pname, jobject params, jint params_position, jlong function_pointer) { + GLuint64EXT *params_address = ((GLuint64EXT *)(*env)->GetDirectBufferAddress(env, params)) + params_position; + glGetQueryObjectui64vEXTPROC glGetQueryObjectui64vEXT = (glGetQueryObjectui64vEXTPROC)((intptr_t)function_pointer); + glGetQueryObjectui64vEXT(id, pname, params_address); +} + Modified: trunk/LWJGL/src/native/generated/org_lwjgl_opengl_GL11.c =================================================================== --- trunk/LWJGL/src/native/generated/org_lwjgl_opengl_GL11.c 2006-07-05 10:47:15 UTC (rev 2448) +++ trunk/LWJGL/src/native/generated/org_lwjgl_opengl_GL11.c 2006-07-07 10:36:26 UTC (rev 2449) @@ -843,7 +843,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_GL11_nglGetString(JNIEnv *env, jclass clazz, jint name, jlong function_pointer) { glGetStringPROC glGetString = (glGetStringPROC)((intptr_t)function_pointer); const GLubyte * __result = glGetString(name); - return NewStringNative(env, __result); + return NewStringNativeUnsigned(env, __result); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_GL11_nglGetPolygonStipple(JNIEnv *env, jclass clazz, jobject mask, jint mask_position, jlong function_pointer) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eli...@us...> - 2006-07-12 16:55:16
|
Revision: 2496 Author: elias_naur Date: 2006-07-12 09:55:05 -0700 (Wed, 12 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2496&view=rev Log Message: ----------- Windows: Use the standard _WIN32 macro instead of the LWJGL defined WIN32. Modified Paths: -------------- trunk/LWJGL/platform_build/windows_ant/build.xml trunk/LWJGL/src/native/common/common_tools.c Modified: trunk/LWJGL/platform_build/windows_ant/build.xml =================================================================== --- trunk/LWJGL/platform_build/windows_ant/build.xml 2006-07-11 23:03:11 UTC (rev 2495) +++ trunk/LWJGL/platform_build/windows_ant/build.xml 2006-07-12 16:55:05 UTC (rev 2496) @@ -11,7 +11,7 @@ <target name="compile_dir"> <apply dir="." failonerror="true" executable="cl" dest="." skipemptyfilesets="true"> - <arg line="/Ox /Wp64 /W2 /nologo /Ox /Ob2 /Oi /Ot /Oy /FD /EHsc /MT /Gy /W2 /nologo /c /D WIN32 /c"/> + <arg line="/Ox /Wp64 /W2 /nologo /Ox /Ob2 /Oi /Ot /Oy /FD /EHsc /MT /Gy /W2 /nologo /c /c"/> <arg value="/I${sdkhome}\include"/> <arg value="/I${dxhome}\include"/> <arg value="/I${alhome}\include"/> Modified: trunk/LWJGL/src/native/common/common_tools.c =================================================================== --- trunk/LWJGL/src/native/common/common_tools.c 2006-07-11 23:03:11 UTC (rev 2495) +++ trunk/LWJGL/src/native/common/common_tools.c 2006-07-12 16:55:05 UTC (rev 2496) @@ -40,7 +40,7 @@ #include <jni.h> #include <stdlib.h> -#ifdef WIN32 +#ifdef _WIN32 #include <wtypes.h> #endif @@ -82,7 +82,7 @@ #define BUFFER_SIZE 4000 char buffer[BUFFER_SIZE]; jstring str; -#ifdef WIN32 +#ifdef _WIN32 vsnprintf_s(buffer, BUFFER_SIZE, _TRUNCATE, format, ap); #else vsnprintf(buffer, BUFFER_SIZE, format, ap); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eli...@us...> - 2006-07-14 16:15:05
|
Revision: 2514 Author: elias_naur Date: 2006-07-14 09:14:52 -0700 (Fri, 14 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2514&view=rev Log Message: ----------- Split the external LWJGL version from the internal version of the native JNI library. The internal JNI version is now an integer. This has multiple advantages over the old way: 1. The JNI_VERSION field is now included automatically in the generated JNI headers, relieving us of the burden of updating the version number in both java and native code. 2. We can update the JNI version with every non-compatible change of the JNI library API, not just once per release, giving us extra safety when users download and build LWJGL from SVN. 3. We can now avoid rebuilding natives if a particular release only contains java changes. Currently, This is mostly a problem when Brian bumps the external version prior a release and I forget to re-build the natives ;) Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java trunk/LWJGL/src/java/org/lwjgl/Sys.java trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java trunk/LWJGL/src/native/common/common_tools.c Modified: trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java 2006-07-14 13:07:38 UTC (rev 2513) +++ trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java 2006-07-14 16:14:52 UTC (rev 2514) @@ -39,7 +39,10 @@ * $Id$ */ abstract class DefaultSysImplementation implements SysImplementation { - public native String getNativeLibraryVersion(); + /** Included to let native have easy access to Sys.JNI_VERSION */ + private final static int JNI_VERSION = Sys.JNI_VERSION; + + public native int getJNIVersion(); public native void setDebug(boolean debug); public long getTimerResolution() { Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-07-14 13:07:38 UTC (rev 2513) +++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-07-14 16:14:52 UTC (rev 2514) @@ -56,6 +56,9 @@ /** Current version of library */ private static final String VERSION = "1.0beta2"; + /** Current version of the JNI library */ + static final int JNI_VERSION = 1; + /** The implementation instance to delegate platform specific behavior to */ private final static SysImplementation implementation; @@ -97,10 +100,10 @@ implementation = createImplementation(); loadLibrary(JNI_LIBRARY_NAME); - String native_version = implementation.getNativeLibraryVersion(); - if (!native_version.equals(getVersion())) - throw new LinkageError("Version mismatch: jar version is '" + getVersion() + - "', native libary version is '" + native_version + "'"); + int native_jni_version = implementation.getJNIVersion(); + if (native_jni_version != JNI_VERSION) + throw new LinkageError("Version mismatch: jar version is '" + JNI_VERSION + + "', native libary version is '" + native_jni_version + "'"); implementation.setDebug(LWJGLUtil.DEBUG); } Modified: trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java 2006-07-14 13:07:38 UTC (rev 2513) +++ trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java 2006-07-14 16:14:52 UTC (rev 2514) @@ -44,7 +44,7 @@ /** * Return the version of the native library */ - String getNativeLibraryVersion(); + int getJNIVersion(); void setDebug(boolean debug); Modified: trunk/LWJGL/src/native/common/common_tools.c =================================================================== --- trunk/LWJGL/src/native/common/common_tools.c 2006-07-14 13:07:38 UTC (rev 2513) +++ trunk/LWJGL/src/native/common/common_tools.c 2006-07-14 16:14:52 UTC (rev 2514) @@ -48,7 +48,6 @@ #include "org_lwjgl_DefaultSysImplementation.h" static bool debug = false; -static const char* VERSION = "1.0beta2"; static JavaVM *jvm; void initAttribList(attrib_list_t *list) { @@ -64,9 +63,9 @@ list->current_index++; } -JNIEXPORT jstring JNICALL Java_org_lwjgl_DefaultSysImplementation_getNativeLibraryVersion +JNIEXPORT jint JNICALL Java_org_lwjgl_DefaultSysImplementation_getJNIVersion (JNIEnv *env, jobject ignored) { - return NewStringNative(env, VERSION); + return org_lwjgl_DefaultSysImplementation_JNI_VERSION; } JNIEXPORT void JNICALL Java_org_lwjgl_DefaultSysImplementation_setDebug This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eli...@us...> - 2006-07-15 21:01:23
|
Revision: 2524 Author: elias_naur Date: 2006-07-15 14:01:11 -0700 (Sat, 15 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2524&view=rev Log Message: ----------- Windows: Replace _WIN32 macro with _MSC_VER since the conditionals are really for the MSVC compiler, not for the windows platform in general. Code cleanup. Modified Paths: -------------- trunk/LWJGL/src/native/common/common_tools.c trunk/LWJGL/src/native/common/common_tools.h trunk/LWJGL/src/native/windows/org_lwjgl_input_Cursor.c trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c Modified: trunk/LWJGL/src/native/common/common_tools.c =================================================================== --- trunk/LWJGL/src/native/common/common_tools.c 2006-07-15 20:25:56 UTC (rev 2523) +++ trunk/LWJGL/src/native/common/common_tools.c 2006-07-15 21:01:11 UTC (rev 2524) @@ -39,11 +39,6 @@ #include <jni.h> #include <stdlib.h> - -#ifdef _WIN32 -#include <wtypes.h> -#endif - #include "common_tools.h" #include "org_lwjgl_DefaultSysImplementation.h" @@ -81,7 +76,7 @@ #define BUFFER_SIZE 4000 char buffer[BUFFER_SIZE]; jstring str; -#ifdef _WIN32 +#ifdef _MSC_VER vsnprintf_s(buffer, BUFFER_SIZE, _TRUNCATE, format, ap); #else vsnprintf(buffer, BUFFER_SIZE, format, ap); Modified: trunk/LWJGL/src/native/common/common_tools.h =================================================================== --- trunk/LWJGL/src/native/common/common_tools.h 2006-07-15 20:25:56 UTC (rev 2523) +++ trunk/LWJGL/src/native/common/common_tools.h 2006-07-15 21:01:11 UTC (rev 2524) @@ -57,7 +57,7 @@ #endif #endif -#ifdef _WIN32 +#ifdef _MSC_VER #define inline __inline #include <Basetsd.h> #else Modified: trunk/LWJGL/src/native/windows/org_lwjgl_input_Cursor.c =================================================================== --- trunk/LWJGL/src/native/windows/org_lwjgl_input_Cursor.c 2006-07-15 20:25:56 UTC (rev 2523) +++ trunk/LWJGL/src/native/windows/org_lwjgl_input_Cursor.c 2006-07-15 21:01:11 UTC (rev 2524) @@ -88,7 +88,7 @@ colorDIB = CreateDIBSection(GetDC(NULL), (BITMAPINFO*)&(bitmapInfo), DIB_RGB_COLORS, - (void**)&(ptrCursorImage), + (void*)&(ptrCursorImage), NULL, 0); srcPtr = pixels; dstPtr = ptrCursorImage; Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c =================================================================== --- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2006-07-15 20:25:56 UTC (rev 2523) +++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_Display.c 2006-07-15 21:01:11 UTC (rev 2524) @@ -119,7 +119,7 @@ message_time = GetMessageTime(); handleMessage_method = (*env)->GetStaticMethodID(env, display_class_global, "handleMessage", "(JIJJJ)Z"); if (handleMessage_method != NULL) - if ((*env)->CallStaticBooleanMethod(env, display_class_global, handleMessage_method, (jlong)hWnd, (jint)msg, (jlong)wParam, (jlong)lParam, (jlong)message_time)) + if ((*env)->CallStaticBooleanMethod(env, display_class_global, handleMessage_method, (jlong)(intptr_t)hWnd, (jint)msg, (jlong)wParam, (jlong)lParam, (jlong)message_time)) return 0; } } @@ -190,7 +190,6 @@ jfieldID fid_height = (*env)->GetFieldID(env, cls_displayMode, "height", "I"); int width = (*env)->GetIntField(env, mode, fid_width); int height = (*env)->GetIntField(env, mode, fid_height); - BOOL result; bool isUndecorated; // Whether we're undecorated or not static bool oneShotInitialised = false; if (!oneShotInitialised) { @@ -321,8 +320,6 @@ char *ptrCursorImage; int x, y; char *dstPtr; - int pixelCount; - int scanlinePad; int wordAlignedWidth; int imageSize; unsigned char *maskPixels; @@ -332,8 +329,6 @@ int scanlineWidth; HBITMAP colorDIB; - jsize pixelsLen = width * height; - memset(&bitmapInfo, 0, sizeof(BITMAPINFO)); bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bitmapInfo.bmiHeader.biWidth = width; @@ -343,7 +338,7 @@ bitmapInfo.bmiHeader.biCompression = BI_RGB; colorDIB = CreateDIBSection(GetDC(NULL), (BITMAPINFO*)&(bitmapInfo), - DIB_RGB_COLORS, (void**)&(ptrCursorImage), NULL, 0); + DIB_RGB_COLORS, (void*)&(ptrCursorImage), NULL, 0); if (!ptrCursorImage) { throwException(env, "Could not allocate DIB section."); } @@ -435,7 +430,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetWindowIcon16 (JNIEnv *env, jclass clazz, jobject iconBuffer) { - int *imgData = (int *)(*env)->GetDirectBufferAddress(env, iconBuffer); + jint *imgData = (jint *)(*env)->GetDirectBufferAddress(env, iconBuffer); freeSmallIcon(); small_icon = createWindowIcon(env, imgData, 16, 16); @@ -453,7 +448,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_opengl_WindowsDisplay_nSetWindowIcon32 (JNIEnv *env, jclass clazz, jobject iconBuffer) { - int *imgData = (int *)(*env)->GetDirectBufferAddress(env, iconBuffer); + jint *imgData = (jint *)(*env)->GetDirectBufferAddress(env, iconBuffer); freeLargeIcon(); large_icon = createWindowIcon(env, imgData, 32, 32); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2007-04-19 22:39:10
|
Revision: 2786 http://svn.sourceforge.net/java-game-lib/?rev=2786&view=rev Author: matzon Date: 2007-04-19 15:39:08 -0700 (Thu, 19 Apr 2007) Log Message: ----------- using NewStringNativeWithLength Modified Paths: -------------- trunk/LWJGL/src/native/common/devil/org_lwjgl_devil_IL.c trunk/LWJGL/src/native/common/devil/org_lwjgl_devil_ILU.c trunk/LWJGL/src/native/common/devil/org_lwjgl_devil_ILUT.c trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMusic.c trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FSound.c Modified: trunk/LWJGL/src/native/common/devil/org_lwjgl_devil_IL.c =================================================================== --- trunk/LWJGL/src/native/common/devil/org_lwjgl_devil_IL.c 2007-04-19 22:26:19 UTC (rev 2785) +++ trunk/LWJGL/src/native/common/devil/org_lwjgl_devil_IL.c 2007-04-19 22:39:08 UTC (rev 2786) @@ -517,7 +517,8 @@ * Signature: (I)Ljava/lang/String; */ static jstring JNICALL Java_org_lwjgl_devil_IL_ilGetString(JNIEnv *env, jclass clazz, jint stringName) { - return NewStringNative(env, ilGetString((ILenum)stringName)); + char * name = ilGetString((ILenum)stringName); + return NewStringNativeWithLength(env, name, strlen(name)); } /* Modified: trunk/LWJGL/src/native/common/devil/org_lwjgl_devil_ILU.c =================================================================== --- trunk/LWJGL/src/native/common/devil/org_lwjgl_devil_ILU.c 2007-04-19 22:26:19 UTC (rev 2785) +++ trunk/LWJGL/src/native/common/devil/org_lwjgl_devil_ILU.c 2007-04-19 22:39:08 UTC (rev 2786) @@ -245,7 +245,8 @@ * Signature: (I)Ljava/lang/String; */ static jstring JNICALL Java_org_lwjgl_devil_ILU_iluErrorString(JNIEnv *env, jclass clazz, jint error) { - return NewStringNative(env, iluErrorString((ILenum)error)); + char * errorstring = iluErrorString((ILenum)error); + return NewStringNativeWithLength(env, errorstring, strlen(errorstring)); } /* @@ -366,7 +367,8 @@ * Signature: (I)Ljava/lang/String; */ static jstring JNICALL Java_org_lwjgl_devil_ILU_iluGetString(JNIEnv *env, jclass clazz, jint stringName) { - return NewStringNative(env, iluGetString((ILenum)stringName)); + char * name = iluGetString((ILenum)stringName); + return NewStringNativeWithLength(env, name, strlen(name)); } /* Modified: trunk/LWJGL/src/native/common/devil/org_lwjgl_devil_ILUT.c =================================================================== --- trunk/LWJGL/src/native/common/devil/org_lwjgl_devil_ILUT.c 2007-04-19 22:26:19 UTC (rev 2785) +++ trunk/LWJGL/src/native/common/devil/org_lwjgl_devil_ILUT.c 2007-04-19 22:39:08 UTC (rev 2786) @@ -120,7 +120,8 @@ * Signature: (I)Ljava/lang/String; */ static jstring JNICALL Java_org_lwjgl_devil_ILUT_ilutGetString(JNIEnv *env, jclass clazz, jint stringName){ - return NewStringNative(env, ilutGetString((ILenum)stringName)); + char * name = ilutGetString((ILenum)stringName); + return NewStringNativeWithLength(env, name, strlen(name)); } /* Modified: trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c =================================================================== --- trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c 2007-04-19 22:26:19 UTC (rev 2785) +++ trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c 2007-04-19 22:39:08 UTC (rev 2786) @@ -82,5 +82,6 @@ * Signature: (I)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_lwjgl_fmod3_FMOD_FMOD_1ErrorString(JNIEnv *env, jclass clazz, jint errorcode) { - return NewStringNative(env, FMOD_ErrorString(errorcode)); + char * error = FMOD_ErrorString(errorcode); + return NewStringNativeWithLength(env, error, strlen(error)); } Modified: trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMusic.c =================================================================== --- trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMusic.c 2007-04-19 22:26:19 UTC (rev 2785) +++ trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FMusic.c 2007-04-19 22:39:08 UTC (rev 2786) @@ -281,7 +281,7 @@ JNIEXPORT jstring JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetName (JNIEnv *env, jclass clazz, jlong module) { const char * name = fmod_instance->FMUSIC_GetName((FMUSIC_MODULE *) module); - return NewStringNative(env, name); + return NewStringNativeWithLength(env, name, strlen(name)); } /* Modified: trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FSound.c =================================================================== --- trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FSound.c 2007-04-19 22:26:19 UTC (rev 2785) +++ trunk/LWJGL/src/native/common/fmod3/org_lwjgl_fmod3_FSound.c 2007-04-19 22:39:08 UTC (rev 2786) @@ -230,7 +230,8 @@ * Signature: (I)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetDriverName(JNIEnv * env, jclass clazz, jint id) { - return NewStringNative(env, (const char *) fmod_instance->FSOUND_GetDriverName(id)); + char * driver = fmod_instance->FSOUND_GetDriverName(id); + return NewStringNativeWithLength(env, driver, strlen(driver)); } /* @@ -430,7 +431,8 @@ * Signature: (J)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1GetName(JNIEnv * env, jclass clazz, jlong sptr) { - return NewStringNative(env, fmod_instance->FSOUND_Sample_GetName((FSOUND_SAMPLE *) sptr)); + char * name = fmod_instance->FSOUND_Sample_GetName((FSOUND_SAMPLE *) sptr); + return NewStringNativeWithLength(env, name, strlen(name)); } /* @@ -1203,7 +1205,7 @@ unsigned int * nPcmOffset = pcmOffsetPosition + (unsigned int *) (*env)->GetDirectBufferAddress(env, pcmOffset); char * result = fmod_instance->FSOUND_Stream_GetSyncPointInfo(nPoint, nPcmOffset); if(result != NULL) { - return NewStringNative(env, result); + return NewStringNativeWithLength(env, result, strlen(result)); } return NULL; } @@ -1221,7 +1223,7 @@ if(fmod_instance->FSOUND_Stream_GetTagField((FSOUND_STREAM*) stream, num, &type, &name, &value, &length)) { // create string instance of name - jstring nName = NewStringNative(env, name); + jstring nName = NewStringNativeWithLength(env, name, strlen(name)); // get set method and call it jclass cls = (*env)->GetObjectClass(env, tagField); @@ -1257,7 +1259,8 @@ * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Stream_1Net_1GetLastServerStatus(JNIEnv * env, jclass clazz) { - return NewStringNative(env, fmod_instance->FSOUND_Stream_Net_GetLastServerStatus()); + char * serverstatus = fmod_instance->FSOUND_Stream_Net_GetLastServerStatus(); + return NewStringNativeWithLength(env, serverstatus, strlen(serverstatus)); } /* @@ -1777,7 +1780,8 @@ * Signature: (I)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Record_1GetDriverName(JNIEnv * env, jclass clazz, jint driver) { - return NewStringNative(env, (const char *)fmod_instance->FSOUND_Record_GetDriverName(driver)); + char * drivername = fmod_instance->FSOUND_Record_GetDriverName(driver); + return NewStringNativeWithLength(env, drivername, strlen(drivername)); } /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2007-04-19 23:02:58
|
Revision: 2793 http://svn.sourceforge.net/java-game-lib/?rev=2793&view=rev Author: matzon Date: 2007-04-19 16:02:57 -0700 (Thu, 19 Apr 2007) Log Message: ----------- fixing warnings Modified Paths: -------------- trunk/LWJGL/src/native/common/common_tools.c trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c Modified: trunk/LWJGL/src/native/common/common_tools.c =================================================================== --- trunk/LWJGL/src/native/common/common_tools.c 2007-04-19 22:58:13 UTC (rev 2792) +++ trunk/LWJGL/src/native/common/common_tools.c 2007-04-19 23:02:57 UTC (rev 2793) @@ -204,7 +204,6 @@ jmethodID jmethod_str; jstring result; jbyteArray bytes; - int len; if (str==NULL) { return NULL; } Modified: trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c =================================================================== --- trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c 2007-04-19 22:58:13 UTC (rev 2792) +++ trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c 2007-04-19 23:02:57 UTC (rev 2793) @@ -190,7 +190,6 @@ */ static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcMakeContextCurrent (JNIEnv *env, jclass clazz, jlong contextaddress) { ALCcontext* context = (ALCcontext*)((intptr_t)contextaddress); - ALCenum result; return alcMakeContextCurrent(context); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eli...@us...> - 2008-04-07 19:31:26
|
Revision: 2988 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=2988&view=rev Author: elias_naur Date: 2008-04-07 12:31:23 -0700 (Mon, 07 Apr 2008) Log Message: ----------- Removed unused native function getJVM() Modified Paths: -------------- trunk/LWJGL/src/native/common/common_tools.c trunk/LWJGL/src/native/common/common_tools.h Modified: trunk/LWJGL/src/native/common/common_tools.c =================================================================== --- trunk/LWJGL/src/native/common/common_tools.c 2008-04-07 19:21:40 UTC (rev 2987) +++ trunk/LWJGL/src/native/common/common_tools.c 2008-04-07 19:31:23 UTC (rev 2988) @@ -309,10 +309,6 @@ return (*env)->CallStaticBooleanMethod(env, org_lwjgl_LWJGLUtil_class, getBoolean, property) ? true : false; } -JavaVM *getJVM() { - return jvm; -} - JNIEnv *getThreadEnv() { JNIEnv *env; (*jvm)->GetEnv(jvm, (void *)&env, JNI_VERSION_1_4); Modified: trunk/LWJGL/src/native/common/common_tools.h =================================================================== --- trunk/LWJGL/src/native/common/common_tools.h 2008-04-07 19:21:40 UTC (rev 2987) +++ trunk/LWJGL/src/native/common/common_tools.h 2008-04-07 19:31:23 UTC (rev 2988) @@ -122,7 +122,6 @@ extern "C" { #endif -extern JavaVM *getJVM(); extern JNIEnv *getThreadEnv(); extern void initAttribList(attrib_list_t *list); extern void putAttrib(attrib_list_t *list, int attrib); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |