mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 07:16:49 +02:00
TAChart: Add OpenGL demo
git-svn-id: trunk@29707 -
This commit is contained in:
parent
88e5894c6e
commit
48e68e866e
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -2378,6 +2378,10 @@ components/tachart/demo/multi/Main.lfm svneol=native#text/plain
|
||||
components/tachart/demo/multi/Main.pas svneol=native#text/pascal
|
||||
components/tachart/demo/multi/multidemo.lpi svneol=native#text/plain
|
||||
components/tachart/demo/multi/multidemo.lpr svneol=native#text/pascal
|
||||
components/tachart/demo/opengl/Main.lfm svneol=native#text/plain
|
||||
components/tachart/demo/opengl/Main.pas svneol=native#text/pascal
|
||||
components/tachart/demo/opengl/opengldemo.lpi svneol=native#text/plain
|
||||
components/tachart/demo/opengl/opengldemo.lpr svneol=native#text/pascal
|
||||
components/tachart/demo/print/Main.lfm svneol=native#text/plain
|
||||
components/tachart/demo/print/Main.pas svneol=native#text/pascal
|
||||
components/tachart/demo/print/printdemo.lpi svneol=native#text/plain
|
||||
|
65
components/tachart/demo/opengl/Main.lfm
Normal file
65
components/tachart/demo/opengl/Main.lfm
Normal file
@ -0,0 +1,65 @@
|
||||
object Form1: TForm1
|
||||
Left = 308
|
||||
Height = 319
|
||||
Top = 132
|
||||
Width = 684
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 319
|
||||
ClientWidth = 684
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '0.9.31'
|
||||
object OpenGLControl1: TOpenGLControl
|
||||
Left = 344
|
||||
Height = 319
|
||||
Top = 0
|
||||
Width = 340
|
||||
Align = alClient
|
||||
AutoResizeViewport = True
|
||||
OnPaint = OpenGLControl1Paint
|
||||
end
|
||||
object Chart1: TChart
|
||||
Left = 0
|
||||
Height = 319
|
||||
Top = 0
|
||||
Width = 344
|
||||
AxisList = <
|
||||
item
|
||||
Marks.Frame.Style = psSolid
|
||||
Marks.LabelBrush.Color = clYellow
|
||||
Marks.LabelBrush.Style = bsSolid
|
||||
Title.LabelFont.Orientation = 900
|
||||
end
|
||||
item
|
||||
Alignment = calBottom
|
||||
end>
|
||||
Foot.Brush.Color = clBtnFace
|
||||
Foot.Font.Color = clBlue
|
||||
Title.Brush.Color = clBtnFace
|
||||
Title.Font.Color = clBlue
|
||||
Title.Text.Strings = (
|
||||
'Standard'
|
||||
)
|
||||
Title.Visible = True
|
||||
Align = alLeft
|
||||
ParentColor = False
|
||||
object Chart1LineSeries1: TLineSeries
|
||||
LinePen.Color = clBlue
|
||||
LinePen.Width = 3
|
||||
Source = RandomChartSource1
|
||||
end
|
||||
object Chart1BarSeries1: TBarSeries
|
||||
BarBrush.Color = clRed
|
||||
Source = RandomChartSource1
|
||||
end
|
||||
end
|
||||
object RandomChartSource1: TRandomChartSource
|
||||
PointsNumber = 10
|
||||
RandSeed = 1792875960
|
||||
XMax = 10
|
||||
XMin = 0
|
||||
YMax = 10
|
||||
YMin = 0
|
||||
left = 210
|
||||
top = 161
|
||||
end
|
||||
end
|
67
components/tachart/demo/opengl/Main.pas
Normal file
67
components/tachart/demo/opengl/Main.pas
Normal file
@ -0,0 +1,67 @@
|
||||
unit Main;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, OpenGLContext, SysUtils, FileUtil, Forms, Controls, Graphics,
|
||||
Dialogs, TAGraph, TASeries, TASources, GL, GLU, TADrawerOpenGL, TADrawUtils;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
Chart1: TChart;
|
||||
Chart1BarSeries1: TBarSeries;
|
||||
Chart1LineSeries1: TLineSeries;
|
||||
OpenGLControl1: TOpenGLControl;
|
||||
RandomChartSource1: TRandomChartSource;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure OpenGLControl1Paint(Sender: TObject);
|
||||
private
|
||||
procedure OnAppIdle(Sender: TObject; var Done: Boolean);
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Application.AddOnIdleHandler(@OnAppIdle);
|
||||
end;
|
||||
|
||||
procedure TForm1.OnAppIdle(Sender: TObject; var Done: Boolean);
|
||||
begin
|
||||
Done:=false;
|
||||
OpenGLControl1.Invalidate;
|
||||
end;
|
||||
|
||||
procedure TForm1.OpenGLControl1Paint(Sender: TObject);
|
||||
var
|
||||
d: IChartDrawer;
|
||||
begin
|
||||
glClearColor(1.0, 1.0, 1.0, 1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
with OpenGLControl1 do
|
||||
gluOrtho2D(0, Width, Height, 0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
d := TOpenGLDrawer.Create(OpenGLControl1);
|
||||
Chart1.Title.Text.Text := 'OpenGL';
|
||||
Chart1.Draw(d, Rect(0, 0, OpenGLControl1.Width, OpenGLControl1.Height));
|
||||
Chart1.Title.Text.Text := 'Standard';
|
||||
|
||||
OpenGLControl1.SwapBuffers;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
97
components/tachart/demo/opengl/opengldemo.lpi
Normal file
97
components/tachart/demo/opengl/opengldemo.lpi
Normal file
@ -0,0 +1,97 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="3">
|
||||
<Item1>
|
||||
<PackageName Value="TAChartLazarusPkg"/>
|
||||
<MinVersion Major="1" Valid="True"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LazOpenGLContext"/>
|
||||
<MinVersion Release="1" Valid="True"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item3>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="opengldemo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="opengldemo"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="Main.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="Main"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="10"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="opengldemo"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="..\.."/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerMessages>
|
||||
<UseMsgFile Value="True"/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
20
components/tachart/demo/opengl/opengldemo.lpr
Normal file
20
components/tachart/demo/opengl/opengldemo.lpr
Normal file
@ -0,0 +1,20 @@
|
||||
program opengldemo;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, lazopenglcontext, Main, tachartlazaruspkg;
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource := True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user