; RenderTriangles Example ; ----------------------- ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,3,-14 light=CreateLight() RotateEntity light,45,45,0 ; An asteroid ring the player can switch off to change the triangle count hub=CreatePivot() Dim rocks(29) For n=0 To 29 rocks(n)=CreateSphere(24) ScaleEntity rocks(n),0.6,0.6,0.6 PositionEntity rocks(n),6*Cos(n*12),2*Sin(n*47),6*Sin(n*12) EntityParent rocks(n),hub EntityColor rocks(n),130,120,110 Next heavy=True While Not KeyDown(1) ; Space toggles the asteroid ring on and off If KeyHit(57) Then heavy=Not heavy For n=0 To 29 If heavy Then ShowEntity rocks(n) Else HideEntity rocks(n) Next EndIf TurnEntity hub,0,0.5,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld ; RenderTriangles counts main-scene triangles executed in the last frame Text 0,0,"Arrow keys: move camera Space: toggle asteroids Esc: exit" Text 0,20,"RenderTriangles() = "+RenderTriangles() Text 0,40,"Shadows and this 2D text are not included in the count" Flip Wend End