O'Reilly logo

3D Game Programming for Teens, Second Edition by Eric Grebler, Maneesh Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Cone

Let’s start by entering the code for creating a cone and then going through each line to see what we have accomplished.

; demo05-01.bb - Creating a Basic Cone
; ------------------

Graphics3D 640,480
SetBuffer BackBuffer()

Const ESC_KEY = 1
; Create camera
camera = CreateCamera()
; Create a light
light = CreateLight()

; This is the code for creating the cone
cone = CreateCone()
PositionEntity cone,0,0,5


; This following code makes our program run
While Not KeyDown(ESC_KEY)
      RenderWorld
      Flip
Wend
End

You can find this code on the CD; it is titled demo05-01.bb. Open it up into Blitz3D and press the Run button to see the masterpiece you have created. With any luck, what you see on your screen should look exactly like what you see ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required