From 062057d3d9cae330f7f0bd36480fafd0aade9791 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Wed, 10 Mar 2004 08:42:40 +0000 Subject: [PATCH] Fixed win32 building --- src/java/org/lwjgl/test/openal/BasicTest.java | 2 +- src/native/common/extal.cpp | 12 +++++++++++- src/native/common/extal.h | 13 +++++++++++++ src/native/common/extgl.cpp | 10 +++++----- src/native/common/extgl.h | 4 ++-- src/native/common/org_lwjgl_openal_AL10.cpp | 11 +++-------- src/native/common/org_lwjgl_openal_ALC.cpp | 3 +-- 7 files changed, 36 insertions(+), 19 deletions(-) diff --git a/src/java/org/lwjgl/test/openal/BasicTest.java b/src/java/org/lwjgl/test/openal/BasicTest.java index f5569763..e2157215 100644 --- a/src/java/org/lwjgl/test/openal/BasicTest.java +++ b/src/java/org/lwjgl/test/openal/BasicTest.java @@ -56,7 +56,7 @@ public abstract class BasicTest { try { AL.create(); } catch (Exception e) { - System.out.println("Unable to create OpenAL.\nPlease make sure that OpenAL is available on this system."); + System.out.println("Unable to create OpenAL.\nPlease make sure that OpenAL is available on this system. Exception: " + e); return; } } diff --git a/src/native/common/extal.cpp b/src/native/common/extal.cpp index c4ce4a19..08a5ae7c 100644 --- a/src/native/common/extal.cpp +++ b/src/native/common/extal.cpp @@ -68,6 +68,8 @@ void* handleOAL; const struct mach_header* handleOAL; #endif +alGetProcAddressPROC alGetProcAddress; + /* Loads OpenAL */ static bool LoadOpenAL(JNIEnv *env, jobjectArray oalPaths); @@ -230,21 +232,29 @@ void InitializeOpenAL(JNIEnv *env, jobjectArray oalPaths) { if (!LoadOpenAL(env, oalPaths)) { return; } - + alGetProcAddress = (alGetProcAddressPROC)extal_GetProcAddress("alGetProcAddress"); + if (alGetProcAddress == NULL) { + DeInitializeOpenAL(); + throwOpenALException(env, "Could not load alGetProcAddress function pointer."); + return; + } //load basic OpenAL functions if(!LoadAL(env)) { + DeInitializeOpenAL(); throwOpenALException(env, "Could not load OpenAL function pointers."); return; } //load OpenAL context functions if(!LoadALC(env)) { + DeInitializeOpenAL(); throwOpenALException(env, "Could not load ALC function pointers."); return; } //load OpenAL extensions if(!LoadALExtensions()) { + DeInitializeOpenAL(); throwOpenALException(env, "Could not load AL extension function pointers."); return; } diff --git a/src/native/common/extal.h b/src/native/common/extal.h index 98d2df07..9b8b451b 100644 --- a/src/native/common/extal.h +++ b/src/native/common/extal.h @@ -154,7 +154,20 @@ extern EAXGet eaxGet; #endif typedef ALvoid (ALAPIENTRY *alEnablePROC)( ALenum capability ); +typedef ALboolean (ALAPIENTRY *alIsExtensionPresentPROC)( ALubyte* fname ); +typedef ALvoid* (ALAPIENTRY *alGetProcAddressPROC)( ALubyte* fname ); +typedef ALubyte* (ALAPIENTRY *alGetStringPROC)( ALenum param ); +typedef ALenum (ALAPIENTRY *alGetErrorPROC)( ALvoid ); + extern alEnablePROC alEnable; +extern alIsExtensionPresentPROC alIsExtensionPresent; +extern alGetProcAddressPROC alGetProcAddress; +extern alGetStringPROC alGetString; +extern alGetErrorPROC alGetError; + +typedef ALCcontext* (ALCAPIENTRY *alcGetCurrentContextPROC)(ALCvoid); +extern alcGetCurrentContextPROC alcGetCurrentContext; + #ifdef __cplusplus } #endif diff --git a/src/native/common/extgl.cpp b/src/native/common/extgl.cpp index 35fba675..1eb6ac94 100755 --- a/src/native/common/extgl.cpp +++ b/src/native/common/extgl.cpp @@ -140,11 +140,11 @@ wglGetExtensionsStringEXTPROC wglGetExtensionsStringEXT = NULL; /* WGL_ARB_buffer_region */ -wglCreateBufferRegionARBPROC wglCreateBufferRegionARB = NULL; +/*wglCreateBufferRegionARBPROC wglCreateBufferRegionARB = NULL; wglDeleteBufferRegionARBPROC wglDeleteBufferRegionARB = NULL; wglSaveBufferRegionARBPROC wglSaveBufferRegionARB = NULL; wglRestoreBufferRegionARBPROC wglRestoreBufferRegionARB = NULL; - +*/ /* WGL_ARB_extension_string */ @@ -393,7 +393,7 @@ static bool WGLQueryExtension(JNIEnv *env, const char *name) return QueryExtension(env, NULL, extensions, name); } -static void extgl_InitWGLARBBufferRegion(JNIEnv *env) +/*static void extgl_InitWGLARBBufferRegion(JNIEnv *env) { if (!extgl_Extensions.WGL_ARB_buffer_region) return; @@ -404,7 +404,7 @@ static void extgl_InitWGLARBBufferRegion(JNIEnv *env) EXTGL_SANITY_CHECK(env, WGL_ARB_buffer_region); } - +*/ static void extgl_InitWGLARBPbuffer(JNIEnv *env) { if (!extgl_Extensions.WGL_ARB_pbuffer) @@ -488,7 +488,7 @@ void extgl_InitWGL(JNIEnv *env) extgl_InitWGLARBRenderTexture(env); extgl_InitWGLARBPixelFormat(env); extgl_InitWGLARBPbuffer(env); - extgl_InitWGLARBBufferRegion(env); + //extgl_InitWGLARBBufferRegion(env); } #endif /* WIN32 */ diff --git a/src/native/common/extgl.h b/src/native/common/extgl.h index d057423f..c32d0ce1 100644 --- a/src/native/common/extgl.h +++ b/src/native/common/extgl.h @@ -2135,12 +2135,12 @@ extern wglGetExtensionsStringEXTPROC wglGetExtensionsStringEXT; /*------------WGL_ARB_BUFFER_REGION----------------------------------*/ /*-------------------------------------------------------------------*/ -#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 +/*#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 #define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 #define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 #define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 -/*typedef HANDLE (APIENTRY * wglCreateBufferRegionARBPROC) (HDC hDC, int iLayerPlane, UINT uType); +typedef HANDLE (APIENTRY * wglCreateBufferRegionARBPROC) (HDC hDC, int iLayerPlane, UINT uType); typedef VOID (APIENTRY * wglDeleteBufferRegionARBPROC) (HANDLE hRegion); typedef BOOL (APIENTRY * wglSaveBufferRegionARBPROC) (HANDLE hRegion, int x, int y, int width, int height); typedef BOOL (APIENTRY * wglRestoreBufferRegionARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); diff --git a/src/native/common/org_lwjgl_openal_AL10.cpp b/src/native/common/org_lwjgl_openal_AL10.cpp index 8d9fa2c2..01533fb9 100644 --- a/src/native/common/org_lwjgl_openal_AL10.cpp +++ b/src/native/common/org_lwjgl_openal_AL10.cpp @@ -54,10 +54,6 @@ typedef ALfloat (ALAPIENTRY *alGetFloatPROC)( ALenum param ); //typedef ALvoid (ALAPIENTRY *alGetBooleanvPROC)( ALenum param, ALboolean* data ); typedef ALvoid (ALAPIENTRY *alGetIntegervPROC)( ALenum param, ALint* data ); typedef ALvoid (ALAPIENTRY *alGetFloatvPROC)( ALenum param, ALfloat* data ); -typedef ALubyte* (ALAPIENTRY *alGetStringPROC)( ALenum param ); -typedef ALenum (ALAPIENTRY *alGetErrorPROC)( ALvoid ); -typedef ALboolean (ALAPIENTRY *alIsExtensionPresentPROC)( ALubyte* fname ); -//typedef ALvoid* (ALAPIENTRY *alGetProcAddressPROC)( ALubyte* fname ); typedef ALenum (ALAPIENTRY *alGetEnumValuePROC)( ALubyte* ename ); typedef ALvoid (ALAPIENTRY *alListeneriPROC)( ALenum param, ALint value ); typedef ALvoid (ALAPIENTRY *alListenerfPROC)( ALenum param, ALfloat value ); @@ -102,6 +98,9 @@ typedef ALvoid (ALAPIENTRY *alDistanceModelPROC)( ALenum value ); typedef ALvoid (ALAPIENTRY *alDopplerFactorPROC)( ALfloat value ); typedef ALvoid (ALAPIENTRY *alDopplerVelocityPROC)( ALfloat value ); +alIsExtensionPresentPROC alIsExtensionPresent; +alGetStringPROC alGetString; +alGetErrorPROC alGetError; alEnablePROC alEnable; static alDisablePROC alDisable; @@ -113,10 +112,6 @@ static alGetFloatPROC alGetFloat; //static alGetBooleanvPROC alGetBooleanv; static alGetIntegervPROC alGetIntegerv; static alGetFloatvPROC alGetFloatv; -static alGetStringPROC alGetString; -static alGetErrorPROC alGetError; -static alIsExtensionPresentPROC alIsExtensionPresent; -//static alGetProcAddressPROC alGetProcAddress; static alGetEnumValuePROC alGetEnumValue; static alListeneriPROC alListeneri; static alListenerfPROC alListenerf; diff --git a/src/native/common/org_lwjgl_openal_ALC.cpp b/src/native/common/org_lwjgl_openal_ALC.cpp index a51b0315..14eb8604 100644 --- a/src/native/common/org_lwjgl_openal_ALC.cpp +++ b/src/native/common/org_lwjgl_openal_ALC.cpp @@ -51,7 +51,6 @@ typedef ALCvoid (ALCAPIENTRY *alcCloseDevicePROC)(ALCdevice *device); typedef ALCcontext* (ALCAPIENTRY *alcCreateContextPROC)(ALCdevice *device,ALCint *attrList); typedef ALCboolean (ALCAPIENTRY *alcMakeContextCurrentPROC)(ALCcontext *context); typedef ALCvoid (ALCAPIENTRY *alcProcessContextPROC)(ALCcontext *context); -typedef ALCcontext* (ALCAPIENTRY *alcGetCurrentContextPROC)(ALCvoid); typedef ALCdevice* (ALCAPIENTRY *alcGetContextsDevicePROC)(ALCcontext *context); typedef ALCvoid (ALCAPIENTRY *alcSuspendContextPROC)(ALCcontext *context); typedef ALCvoid (ALCAPIENTRY *alcDestroyContextPROC)(ALCcontext *context); @@ -60,6 +59,7 @@ typedef ALCboolean (ALCAPIENTRY *alcIsExtensionPresentPROC)(ALCdevice *device,A //typedef ALCvoid* (ALCAPIENTRY *alcGetProcAddressPROC)(ALCdevice *device,ALCubyte *funcName); typedef ALCenum (ALCAPIENTRY *alcGetEnumValuePROC)(ALCdevice *device,ALCubyte *enumName); +alcGetCurrentContextPROC alcGetCurrentContext; static alcGetStringPROC alcGetString; static alcGetIntegervPROC alcGetIntegerv; static alcOpenDevicePROC alcOpenDevice; @@ -67,7 +67,6 @@ static alcCloseDevicePROC alcCloseDevice; static alcCreateContextPROC alcCreateContext; static alcMakeContextCurrentPROC alcMakeContextCurrent; static alcProcessContextPROC alcProcessContext; -static alcGetCurrentContextPROC alcGetCurrentContext; static alcGetContextsDevicePROC alcGetContextsDevice; static alcSuspendContextPROC alcSuspendContext; static alcDestroyContextPROC alcDestroyContext;