From: Gregory P. <gre...@us...> - 2003-01-01 04:05:48
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv6771/src/native/common Modified Files: extgl.h Log Message: Changes to support dynamic loads on the mac and finish the initial build Index: extgl.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extgl.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- extgl.h 30 Dec 2002 22:24:29 -0000 1.6 +++ extgl.h 1 Jan 2003 04:05:44 -0000 1.7 @@ -160,9 +160,13 @@ WGL_NV_render_depth_texture WGL_NV_render_texture_rectangle */ + +//#define _OSX + #ifndef __EXTGL_H__ #define __EXTGL_H__ + /*-----------------------------------------*/ /*-----------------------------------------*/ @@ -324,89 +328,10 @@ #ifdef _OSX #include <Carbon/Carbon.h> -CFBundleRef gBundleRefOpenGL = NULL; -// ------------------------- -OSStatus aglInitEntryPoints (void) -{ - OSStatus err = noErr; - const Str255 frameworkName = "\pOpenGL.framework"; - FSRefParam fileRefParam; - FSRef fileRef; - CFURLRef bundleURLOpenGL; - memset(&fileRefParam, 0, sizeof(fileRefParam)); - memset(&fileRef, 0, sizeof(fileRef)); - fileRefParam.ioNamePtr = frameworkName; - fileRefParam.newRef = &fileRef; - - // Frameworks directory/folder - // - err = FindFolder (kSystemDomain, kFrameworksFolderType, false, &fileRefParam.ioVRefNum, &fileRefParam.ioDirID); - if (noErr != err) - { - DebugStr ("\pCould not find frameworks folder"); - return err; - } - - // make FSRef for folder - // - err = PBMakeFSRefSync (&fileRefParam); - - - if (noErr != err) - { - DebugStr ("\pCould make FSref to frameworks folder"); - return err; - } - - // create URL to folder - // - bundleURLOpenGL = CFURLCreateFromFSRef (kCFAllocatorDefault, &fileRef); - if (!bundleURLOpenGL) - { - DebugStr ("\pCould create OpenGL Framework bundle URL"); - return paramErr; - } - - // create ref to GL's bundle - // - gBundleRefOpenGL = CFBundleCreate (kCFAllocatorDefault,bundleURLOpenGL); - if (!gBundleRefOpenGL) - { - DebugStr ("\pCould not create OpenGL Framework bundle"); - return paramErr; - } - - // release created bundle - // - CFRelease (bundleURLOpenGL); - - // if the code was successfully loaded, look for our function. - if (!CFBundleLoadExecutable (gBundleRefOpenGL)) - { - DebugStr ("\pCould not load MachO executable"); - return paramErr; - } - - return err; -} - - -void aglDellocEntryPoints (void) -{ - if (gBundleRefOpenGL != NULL) - { - // unload the bundle's code. - CFBundleUnloadExecutable (gBundleRefOpenGL); - CFRelease (gBundleRefOpenGL); - gBundleRefOpenGL = NULL; - } -} - +OSStatus aglInitEntryPoints(void); +void aglDellocEntryPoints (void); +void * aglGetProcAddress (char * pszProc); -void * aglGetProcAddress (char * pszProc) -{ - return CFBundleGetFunctionPointerForName (gBundleRefOpenGL,CFStringCreateWithCStringNoCopy (NULL, pszProc, CFStringGetSystemEncoding (), NULL)); -} #endif /* OSX */ /*************************************************************/ @@ -5672,7 +5597,6 @@ extern struct ExtensionTypes extgl_Extensions; -extern struct ExtensionTypes SupportedExtensions; /* deprecated, please do not use */ /* initializes everything, call this right after the rc is created. the function returns 0 if successful */ int extgl_Initialize(); |