procedure TForm1.FormCreate(Sender: TObject);
begin
xorDXThrowAllOtherExceptions := True;
xorDXThrowCameraTransformationExceptions := False;
xorDXThrowIndexSizeException := True;
xorDXThrowCapsException := True;
//creation
Scene := TxorDXScene.Create(
Handle);
Camera := TxorDXCamera.Create(Scene);
Rect := TxorDXRect.Create(Scene, 2, 2, 2, 2);
//set standard coordinates and colors
Wand1:= TxorDXRect.Create(Scene,2,2,2,2);
Wand1.Color[1,0]:=clWhite;
// rechts Unten
Wand1.Color[1,1]:=clBlack;
// rechts oben
Wand1.Color[0,1]:=clYellow;
// Oben Lings
Wand1.Color[0,0]:=clBlue;
// Lings Unten
Wand2:= TxorDXRect.Create(Scene,2,2,2,2);
Wand2.SetStandard;
Wand2.Move(1.9,0,0);
Wand2.FixTransformation;
Wand2.Color[1,0]:=clWhite;
// rechts Unten
Wand2.Color[1,1]:=clBlack;
// rechts oben
Wand2.Color[0,1]:=clYellow;
// Oben Lings
Wand2.Color[0,0]:=clBlue;
// Lings Unten
Scene.CreateBuffers;
//start
Camera.SetStandard;
Camera.Activate;
Scene.BackgroundColor:=clBlue;
Scene.SetAmbientLight(255,125,255,250);
Scene.LightsOn:=True;
Scene.OnDraw := Draw;
//set draw routine
Scene.StartLooping;
Scene.Move(-1,1,1);
Scene.RotateY(-10);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
//free in inverted order of creation
FreeAndNil(Rect);
FreeAndNil(Camera);
FreeAndNil(Scene);
end;
//repeated drawing routine
procedure TForm1.Draw(Sender: TObject);
begin
Scene.Clear;
Rect.Insert;
Rect.RotateZ(-0.10);
Rect.Draw;
Wand1.Insert;
//Wand1.RotateX(-0.01);
Wand1.Draw;
Wand2.UndoTransformation;
Wand2.Insert;
Wand2.RotateZ(0.10);
Wand2.Draw;
// Camera.Move(1,1,4);
end;