TCube=class(TGLSceneObject) public constructor create(AOwner:TComponent); override; procedure BuildList; override; end;Some of the other stuff is used for streaming.
Notice the USES ..,OpenGL12, Geometry,..
OpenGL12 defines simple stuff such as TGLFloat, and Geometry defines TVector3f and so.GLSceneViewer.align:=albottom; GLSceneViewer.top:=100; // leave space for other controls on top GLSceneViewer.height:=ClientHeight-105; Doubleclick GLScene, add a camera (Camera1) Camera1.position:=(0,0,10); // move it a bit further away Camera1.direction:=(0,0,-1); GLSceneViewer.camera:=Camera1;Our component requires a dummycube to become child
Doubleclick GLScene, add a dummycube to the sceneobjects (dummycube1) add to TForm : public MyTetra:TGLTetra; end; drop a button : name='CreateTetra' procedure TForm1.CreateTetraClick(..) begin MyTetra:=TGLTetra(DummyCube1.AddNewChild(TGLTetra)); MyTetra.showaxes:=true; MyTetra.Transformationmode:=tmParentNoPos; end;Showing the axes tells you there is something, even there is an error, such as the size of the object being zero, the object being oriented away and culled, and so on.
Drop a TTrackbar, name='focal', max;=500, min;=50, frequency;=50 procedure tform1.focalchange(..) begin camera1.focallength:=focal.position; end; Drop 6 buttons for rotations : name='px' onclick : mytetra.pitchangle:=mytetra.pitchangle+10; name='nx' onclick : mytetra.pitchangle:=mytetra.pitchangle-10; name='py' onclick : mytetra.turnangle:=mytetra.turnangle+10; name='ny' onclick : mytetra.turnangle:=mytetra.turnangle-10; name='pz' onclick : mytetra.rollangle:=mytetra.rollangle+10; name='nz' onclick : mytetra.rollangle:=mytetra.rollangle-10;The focal trackbar allows zooming out and in, should the object be not at zero. The rotation buttons let you rotate the object.