|
@@ -44,6 +44,10 @@ const |
|
|
GLC_CONTEXT_VERSION_UNKNOWN = -1; |
|
|
GLC_CONTEXT_VERSION_UNKNOWN = -1; |
|
|
|
|
|
|
|
|
type |
|
|
type |
|
|
|
|
|
{$IFNDEF fpc} |
|
|
|
|
|
TThreadID = Cardinal; |
|
|
|
|
|
{$ENDIF} |
|
|
|
|
|
|
|
|
TMultiSample = 1..high(byte); |
|
|
TMultiSample = 1..high(byte); |
|
|
TglcContextPixelFormatSettings = packed record |
|
|
TglcContextPixelFormatSettings = packed record |
|
|
DoubleBuffered: boolean; |
|
|
DoubleBuffered: boolean; |
|
@@ -93,8 +97,8 @@ type |
|
|
property PixelFormatSettings: TglcContextPixelFormatSettings read fPixelFormatSettings; |
|
|
property PixelFormatSettings: TglcContextPixelFormatSettings read fPixelFormatSettings; |
|
|
property VersionSettings: TglcContextVersionSettings read fVersionSettings; |
|
|
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; |
|
|
destructor Destroy; override; |
|
|
|
|
|
|
|
|
property ThreadID: TThreadID read fThreadID; |
|
|
property ThreadID: TThreadID read fThreadID; |
|
@@ -111,11 +115,13 @@ type |
|
|
procedure SetSwapInterval(const aInterval: GLint); virtual; abstract; |
|
|
procedure SetSwapInterval(const aInterval: GLint); virtual; abstract; |
|
|
function GetSwapInterval: GLint; virtual; abstract; |
|
|
function GetSwapInterval: GLint; virtual; abstract; |
|
|
procedure Share(const aContext: TglcContext); virtual; abstract; |
|
|
procedure Share(const aContext: TglcContext); virtual; abstract; |
|
|
|
|
|
|
|
|
|
|
|
{$IFDEF fpc} |
|
|
private class var |
|
|
private class var |
|
|
fMainContextThreadID: TThreadID; |
|
|
fMainContextThreadID: TThreadID; |
|
|
public |
|
|
public |
|
|
class property MainContextThreadID: TThreadID read fMainContextThreadID; |
|
|
class property MainContextThreadID: TThreadID read fMainContextThreadID; |
|
|
|
|
|
{$ENDIF} |
|
|
|
|
|
public |
|
|
class function MakePF(DoubleBuffered: boolean = true; |
|
|
class function MakePF(DoubleBuffered: boolean = true; |
|
|
Stereo: boolean=false; |
|
|
Stereo: boolean=false; |
|
|
MultiSampling: TMultiSample=1; |
|
|
MultiSampling: TMultiSample=1; |
|
@@ -137,12 +143,20 @@ implementation |
|
|
uses |
|
|
uses |
|
|
{$IFDEF WINDOWS} |
|
|
{$IFDEF WINDOWS} |
|
|
uglcContextWGL |
|
|
uglcContextWGL |
|
|
{$ENDIF} |
|
|
|
|
|
|
|
|
{$ELSE}{$IFDEF WIN32} |
|
|
|
|
|
uglcContextWGL{$IFNDEF fpc}, Windows{$ENDIF} |
|
|
|
|
|
{$ENDIF}{$ENDIF} |
|
|
|
|
|
|
|
|
{$IFDEF LINUX} |
|
|
{$IFDEF LINUX} |
|
|
uglcContextGtk2GLX |
|
|
uglcContextGtk2GLX |
|
|
{$ENDIF} |
|
|
{$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} |
|
|
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 |
|
|
var |
|
|
src, typ: String; |
|
|
src, typ: String; |
|
@@ -274,12 +288,17 @@ end; |
|
|
|
|
|
|
|
|
class function TglcContext.GetPlatformClass: TglcContextClass; |
|
|
class function TglcContext.GetPlatformClass: TglcContextClass; |
|
|
begin |
|
|
begin |
|
|
|
|
|
Result := nil; |
|
|
{$IFDEF WINDOWS} |
|
|
{$IFDEF WINDOWS} |
|
|
Result:= TglcContextWGL; |
|
|
Result:= TglcContextWGL; |
|
|
{$ENDIF} |
|
|
|
|
|
|
|
|
{$ELSE}{$IFDEF WIN32} |
|
|
|
|
|
Result:= TglcContextWGL; |
|
|
|
|
|
{$ENDIF}{$ENDIF} |
|
|
{$IFDEF LINUX} |
|
|
{$IFDEF LINUX} |
|
|
Result:= TglcContextGtk2GLX; |
|
|
Result:= TglcContextGtk2GLX; |
|
|
{$ENDIF} |
|
|
{$ENDIF} |
|
|
|
|
|
if not Assigned(result) then |
|
|
|
|
|
raise EGLError.Create('unable to find suitabe context class'); |
|
|
end; |
|
|
end; |
|
|
|
|
|
|
|
|
class function TglcContext.IsAnyContextActive: boolean; |
|
|
class function TglcContext.IsAnyContextActive: boolean; |
|
@@ -340,7 +359,7 @@ begin |
|
|
end; |
|
|
end; |
|
|
|
|
|
|
|
|
initialization |
|
|
initialization |
|
|
TglcContext.fMainContextThreadID := 0; |
|
|
|
|
|
|
|
|
{$IFDEF fpc}TglcContext.{$ENDIF}fMainContextThreadID := 0; |
|
|
|
|
|
|
|
|
end. |
|
|
end. |
|
|
|
|
|
|