|
@@ -29,14 +29,14 @@ const
|
|
|
TINYGLNAME : PChar = 'tinygl.library';
|
|
|
|
|
|
var
|
|
|
- TinyGLBase: Pointer;
|
|
|
- tglContext: Pointer;
|
|
|
+ TinyGLBase: Pointer = nil;
|
|
|
+ tglContext: Pointer = nil;
|
|
|
|
|
|
function InitTinyGLLibrary : boolean;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
-function _GLInit: Pointer;
|
|
|
+function _GLInit: Pointer;
|
|
|
syscall sysvbase TinyGLBase 640;
|
|
|
|
|
|
procedure _GLClose(gcl: pointer);
|
|
@@ -47,34 +47,18 @@ const
|
|
|
VERSION : string[2] = '50';
|
|
|
LIBVERSION : longword = 50;
|
|
|
|
|
|
-var
|
|
|
- tinygl_exit : Pointer;
|
|
|
-
|
|
|
-procedure CloseTinyGLLibrary;
|
|
|
+function InitTinyGLLibrary : boolean;
|
|
|
begin
|
|
|
- ExitProc := tinygl_exit;
|
|
|
- if TinyGLBase <> nil then begin
|
|
|
- if tglContext <> nil then begin
|
|
|
- _GLClose(tglContext);
|
|
|
- tglContext := nil;
|
|
|
- end;
|
|
|
- CloseLibrary(PLibrary(TinyGLBase));
|
|
|
- TinyGLBase := nil;
|
|
|
- end;
|
|
|
+ InitTinyGLLibrary := Assigned(tglContext) and Assigned(TinyGLBase);
|
|
|
end;
|
|
|
|
|
|
-function InitTinyGLLibrary : boolean;
|
|
|
-begin
|
|
|
- TinyGLBase := nil;
|
|
|
+initialization
|
|
|
TinyGLBase := OpenLibrary(TINYGLNAME,LIBVERSION);
|
|
|
- if TinyGLBase <> nil then begin
|
|
|
- tinygl_exit := ExitProc;
|
|
|
- ExitProc := @CloseTinyGLLibrary;
|
|
|
+ if Assigned(TinyGLBase) then
|
|
|
tglContext := _GLInit;
|
|
|
- InitTinyGLLibrary := True;
|
|
|
- end else begin
|
|
|
- InitTinyGLLibrary := False;
|
|
|
- end;
|
|
|
-end;
|
|
|
-
|
|
|
+finalization
|
|
|
+ if Assigned(tglContext) then
|
|
|
+ _GLClose(tglContext);
|
|
|
+ if Assigned(TinyGLBase) then
|
|
|
+ CloseLibrary(PLibrary(TinyGLBase));
|
|
|
end.
|