Commit 67d61341 authored by Bergmann89's avatar Bergmann89

* fixed some bugs to compile with Delphi7

parent fcf42ed1
......@@ -44,6 +44,10 @@ const
GLC_CONTEXT_VERSION_UNKNOWN = -1;
type
{$IFNDEF fpc}
TThreadID = Cardinal;
{$ENDIF}
TMultiSample = 1..high(byte);
TglcContextPixelFormatSettings = packed record
DoubleBuffered: boolean;
......@@ -93,8 +97,8 @@ type
property PixelFormatSettings: TglcContextPixelFormatSettings read fPixelFormatSettings;
property VersionSettings: TglcContextVersionSettings read fVersionSettings;
constructor Create(const aControl: TWinControl; const aPixelFormatSettings: TglcContextPixelFormatSettings); virtual; overload;
constructor Create(const aControl: TWinControl; const aPixelFormatSettings: TglcContextPixelFormatSettings; const aVersionSettings: TglcContextVersionSettings); virtual; overload;
constructor Create(const aControl: TWinControl; const aPixelFormatSettings: TglcContextPixelFormatSettings); overload; virtual;
constructor Create(const aControl: TWinControl; const aPixelFormatSettings: TglcContextPixelFormatSettings; const aVersionSettings: TglcContextVersionSettings); overload; virtual;
destructor Destroy; override;
property ThreadID: TThreadID read fThreadID;
......@@ -111,11 +115,13 @@ type
procedure SetSwapInterval(const aInterval: GLint); virtual; abstract;
function GetSwapInterval: GLint; virtual; abstract;
procedure Share(const aContext: TglcContext); virtual; abstract;
{$IFDEF fpc}
private class var
fMainContextThreadID: TThreadID;
public
class property MainContextThreadID: TThreadID read fMainContextThreadID;
{$ENDIF}
public
class function MakePF(DoubleBuffered: boolean = true;
Stereo: boolean=false;
MultiSampling: TMultiSample=1;
......@@ -137,12 +143,20 @@ implementation
uses
{$IFDEF WINDOWS}
uglcContextWGL
{$ENDIF}
{$ELSE}{$IFDEF WIN32}
uglcContextWGL{$IFNDEF fpc}, Windows{$ENDIF}
{$ENDIF}{$ENDIF}
{$IFDEF LINUX}
uglcContextGtk2GLX
{$ENDIF}
;
{$IFNDEF fpc}
var
fMainContextThreadID: TThreadID;
{$ENDIF}
procedure GlDebugCallbackARB(source: GLenum; type_: GLenum; id: GLuint; severity: GLenum; {%H-}length: GLsizei; const message_: PGLchar; {%H-}userParam: PGLvoid); {$IFDEF WINDOWS}stdcall; {$ELSE}cdecl; {$ENDIF}
var
src, typ: String;
......@@ -274,12 +288,17 @@ end;
class function TglcContext.GetPlatformClass: TglcContextClass;
begin
Result := nil;
{$IFDEF WINDOWS}
Result:= TglcContextWGL;
{$ENDIF}
{$ELSE}{$IFDEF WIN32}
Result:= TglcContextWGL;
{$ENDIF}{$ENDIF}
{$IFDEF LINUX}
Result:= TglcContextGtk2GLX;
{$ENDIF}
if not Assigned(result) then
raise EGLError.Create('unable to find suitabe context class');
end;
class function TglcContext.IsAnyContextActive: boolean;
......@@ -340,7 +359,7 @@ begin
end;
initialization
TglcContext.fMainContextThreadID := 0;
{$IFDEF fpc}TglcContext.{$ENDIF}fMainContextThreadID := 0;
end.
......@@ -21,7 +21,7 @@ type
FRC: HGLRC;
fHandle: THandle;
fPixelFormat: Integer;
{%H-}constructor Create(const aControl: TWinControl);
{%H-}constructor Create(const aControl: TWinControl); overload;
protected
procedure UpdatePixelFormat;
procedure OpenContext; override;
......@@ -29,8 +29,8 @@ type
function FindPixelFormatNoAA: Integer;
procedure OpenFromPF(PixelFormat: Integer);
public
constructor Create(const aControl: TWinControl; const aPixelFormatSettings: TglcContextPixelFormatSettings); override; overload;
constructor Create(const aControl: TWinControl; const aPixelFormatSettings: TglcContextPixelFormatSettings; const aVersionSettings: TglcContextVersionSettings); override; overload;
constructor Create(const aControl: TWinControl; const aPixelFormatSettings: TglcContextPixelFormatSettings); overload; override;
constructor Create(const aControl: TWinControl; const aPixelFormatSettings: TglcContextPixelFormatSettings; const aVersionSettings: TglcContextVersionSettings); overload; override;
procedure CloseContext; override;
procedure Activate; override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment