TAChart: Fix missing initialization of glut library in opengl demo.

git-svn-id: trunk@52347 -
This commit is contained in:
wp 2016-05-22 20:53:45 +00:00
parent cc9413a516
commit 86d8a267aa
2 changed files with 17 additions and 1 deletions

View File

@ -6,6 +6,7 @@ object Form1: TForm1
Caption = 'Form1'
ClientHeight = 319
ClientWidth = 688
OnCreate = FormCreate
LCLVersion = '1.7'
object OpenGLControl1: TOpenGLControl
Left = 344

View File

@ -20,6 +20,7 @@ type
OpenGLControl1: TOpenGLControl;
RandomChartSource1: TRandomChartSource;
procedure Chart1AfterPaint(ASender: TChart);
procedure FormCreate(Sender: TObject);
procedure OpenGLControl1Paint(Sender: TObject);
end;
@ -31,13 +32,27 @@ implementation
{$R *.lfm}
uses
TADrawUtils, TADrawerOpenGL, TADrawerCanvas;
glut, TADrawUtils, TADrawerOpenGL in '../../tadraweropengl.pas', TADrawerCanvas;
procedure TForm1.Chart1AfterPaint(ASender: TChart);
begin
OpenGLControl1.Invalidate;
end;
{ Initialization of glut library, needed for text output }
procedure TForm1.FormCreate(Sender: TObject);
var
CmdCount : Integer;
Cmd : Array of Pchar;
I: Integer;
begin
CmdCount := Paramcount+1;
SetLength(Cmd,CmdCount);
for I := 0 to CmdCount - 1 do
Cmd[I] := PChar(ParamStr(I));
glutInit (@CmdCount,@Cmd);
end;
procedure TForm1.OpenGLControl1Paint(Sender: TObject);
var
d: IChartDrawer;