Browse Source

+ basic Mac OS X support, only bounce works for now though

Jonas Maebe 21 years ago
parent
commit
1ef474cd76

+ 12 - 1
packages/extra/opengl/dllfuncs.pp

@@ -14,6 +14,7 @@ uses SysUtils;
 function LoadLibrary(Name: PChar): THandle;
 function LoadLibrary(Name: PChar): THandle;
 function GetProcAddress(Lib: THandle; ProcName: PChar): Pointer;
 function GetProcAddress(Lib: THandle; ProcName: PChar): Pointer;
 function FreeLibrary(Lib: THandle): Boolean;
 function FreeLibrary(Lib: THandle): Boolean;
+function getlastdlerror: pchar;
 
 
 
 
 implementation
 implementation
@@ -27,12 +28,19 @@ const
 function dlopen(Name: PChar; Flags: LongInt) : Pointer; cdecl; external 'dl';
 function dlopen(Name: PChar; Flags: LongInt) : Pointer; cdecl; external 'dl';
 function dlsym(Lib: Pointer; Name: PChar) : Pointer; cdecl; external 'dl';
 function dlsym(Lib: Pointer; Name: PChar) : Pointer; cdecl; external 'dl';
 function dlclose(Lib: Pointer): LongInt; cdecl; external 'dl';
 function dlclose(Lib: Pointer): LongInt; cdecl; external 'dl';
+function dlerror: pchar; cdecl; external 'dl';
 {$else}
 {$else}
 function dlopen(Name: PChar; Flags: LongInt) : Pointer; cdecl; external 'c';
 function dlopen(Name: PChar; Flags: LongInt) : Pointer; cdecl; external 'c';
 function dlsym(Lib: Pointer; Name: PChar) : Pointer; cdecl; external 'c';
 function dlsym(Lib: Pointer; Name: PChar) : Pointer; cdecl; external 'c';
 function dlclose(Lib: Pointer): LongInt; cdecl; external 'c';
 function dlclose(Lib: Pointer): LongInt; cdecl; external 'c';
+function dlerror: pchar; cdecl; external 'c';
 {$endif}
 {$endif}
 
 
+function getlastdlerror: pchar;
+begin
+  getlastdlerror := dlerror;
+end;
+
 function LoadLibrary(Name: PChar): THandle;
 function LoadLibrary(Name: PChar): THandle;
 begin
 begin
   Result := THandle(dlopen(Name, RTLD_LAZY));
   Result := THandle(dlopen(Name, RTLD_LAZY));
@@ -56,7 +64,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2003-08-25 18:16:38  marco
+  Revision 1.3  2004-11-24 20:04:09  jonas
+    + basic Mac OS X support, only bounce works for now though
+
+  Revision 1.2  2003/08/25 18:16:38  marco
    * BSD fix
    * BSD fix
 
 
   Revision 1.1  2002/10/13 13:57:30  sg
   Revision 1.1  2002/10/13 13:57:30  sg

+ 8 - 1
packages/extra/opengl/gl.pp

@@ -2253,9 +2253,16 @@ initialization
     {$IFDEF Win32}
     {$IFDEF Win32}
     LoadOpenGL('opengl32.dll');
     LoadOpenGL('opengl32.dll');
     {$ELSE}
     {$ELSE}
+    {$ifdef darwin}
+    LoadOpenGL('/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib');
+    {$ELSE}
     LoadOpenGL('libGL.so.1');
     LoadOpenGL('libGL.so.1');
+    {$endif}
     {$ENDIF}
     {$ENDIF}
-  except end;
+  except
+    writeln('Error opening OpenGL library');
+    halt(1);
+  end;
 
 
 finalization
 finalization
 
 

+ 13 - 2
packages/extra/opengl/glu.pp

@@ -502,9 +502,16 @@ initialization
     {$IFDEF Win32}
     {$IFDEF Win32}
     LoadGLu('glu32.dll');
     LoadGLu('glu32.dll');
     {$ELSE}
     {$ELSE}
+    {$ifdef darwin}
+    LoadGLu('/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib');
+    {$else}
     LoadGLu('libGLU.so.1');
     LoadGLu('libGLU.so.1');
     {$ENDIF}
     {$ENDIF}
-  except end;
+    {$endif}
+  except
+    writeln('error opening libGLU: ',getlastdlerror);
+    halt(1);
+  end;
 
 
 finalization
 finalization
 
 
@@ -515,7 +522,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2002-10-13 14:36:47  sg
+  Revision 1.3  2004-11-24 20:04:09  jonas
+    + basic Mac OS X support, only bounce works for now though
+
+  Revision 1.2  2002/10/13 14:36:47  sg
   * Win32 fix: The OS symbol is called "Win32", not "Windows"
   * Win32 fix: The OS symbol is called "Win32", not "Windows"
 
 
   Revision 1.1  2002/10/13 13:57:31  sg
   Revision 1.1  2002/10/13 13:57:31  sg
@@ -524,3 +534,4 @@ end.
     by Tom Nuydens of delphi3d.net
     by Tom Nuydens of delphi3d.net
 
 
 }
 }
+

+ 5 - 0
packages/extra/opengl/glut.pp

@@ -636,7 +636,11 @@ initialization
     {$IFDEF Win32}
     {$IFDEF Win32}
     LoadGlut('glut32.dll');
     LoadGlut('glut32.dll');
     {$ELSE}
     {$ELSE}
+    {$ifdef darwin}
+    LoadGlut('/System/Library/Frameworks/GLUT.framework/Versions/Current/GLUT');
+    {$else}
     LoadGlut('libglut.so.3');
     LoadGlut('libglut.so.3');
+    {$endif}
     {$ENDIF}
     {$ENDIF}
   except
   except
     writeln('Can''t load glut library');
     writeln('Can''t load glut library');
@@ -653,3 +657,4 @@ end.
 {
 {
   $Log:
   $Log:
 }
 }
+