unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, GLWin32Viewer, GLCrossPlatform, BaseClasses, GLScene,
GLObjects, GLCoordinates, GLNodes, GLColor, GLRenderContextInfo, GLMaterial, GLState, GLTexture, VectorLists, VectorTypes, ComCtrls,
CheckLst, te_forms, te_extctrls, Math, GLGeomObjects, GLMultiPolygon;
type
TForm1 =
class(TForm)
GLScene1: TGLScene;
GLSceneViewer1: TGLSceneViewer;
Button1: TButton;
GLCamera1: TGLCamera;
GLDummyCube1: TGLDummyCube;
GLLightSource1: TGLLightSource;
GLPolygon1: TGLPolygon;
procedure Button1Click(Sender: TObject);
private
procedure UpdateScene();
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.UpdateScene();
var
i,rx,rz : Integer;
nodes : TGLNodes;
procedure DrawPolygon(nodes: TGLNodes);
var
i : Integer;
GLPolygon : TGLPolygon;
begin
//application.processmessages();
GLPolygon := TGLPolygon(GLDummyCube1.AddNewChild(TGLPolygon));
GLPolygon.BeginUpdate;
GLPolygon.Material.FrontProperties.Emission.Color := clrRed;
GLPolygon.Material.PolygonMode := pmFill;
//GLPolygon.Material.PolygonMode := pmLines;
GLPolygon.Nodes := nodes;
{
for i := 0 to nodes.Count - 1 do
begin
GLPolygon.AddNode(nodes.Items[i]);
end;
}
GLPolygon.EndUpdate;
end;
procedure DrawNodes(
var nodes: TGLNodes);
var
j : Integer;
node: TGLNode;
begin
DrawPolygon(nodes);
// Darstellung spiegeln
for j := 0
to nodes.Count - 1
do
begin
node := nodes.Items[j];
node.Y := -node.Y;
nodes.Items[j] := node;
end;
DrawPolygon(nodes);
end;
begin
GLDummyCube1.BeginUpdate;
GLDummyCube1.DeleteChildren;
//nodes := TVectorList.Create;
nodes := TGLNodes.Create(GLDummyCube1);
for i := 0
to 5000
do
begin
rx := Random(200);
rz := Random(100);
nodes.Clear;
nodes.AddNode(-100+rx,0,-55+rz);
nodes.AddNode(-90+rx,0,-55+rz);
nodes.AddNode(-95+rx,0,-50+rz);
DrawNodes(nodes);
end;
GLDummyCube1.EndUpdate;
nodes.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
UpdateScene();
end;
end.