Skip to content

CreateSphere

Narta Xaymar Dirks edited this page Oct 28, 2026 · 6 revisions
Blitz3D

CreateSphere

CreateSphere:Int32 segments:Int32=8, parent:Int32=0
Parameter Mode Type Default Description
segments In Int32 8 Detail of the sphere, 2 to 100. Defaults to 8.
parent In Int32 0 Entity the sphere follows, or 0 for none. Defaults to 0.

Returns: The handle of the new sphere.

Description

Creates a sphere with a radius of 1 around the origin. segments sets how round it looks. A sphere has 2 * segments * (segments - 1) * 2 triangles, so 8 gives 224 and 16 gives 960, and 4 * segments + (segments - 1) * (2 * segments + 1) vertices (151 for 8): each pole has a vertex for every segment, and the seam of a ring is repeated, as in the original. Use the smallest number that still looks smooth at the distance the sphere is seen from. Valid values are 2 to 100.

Examples

Graphics3D 320, 240, 0, 2
SetBuffer BackBuffer()
camera = CreateCamera()
PositionEntity camera, 0, 0, -9
light = CreateLight()
RotateEntity light, 45, 45, 0
For i = 0 To 2
	ball = CreateSphere(4 + i * 6)
	PositionEntity ball, i * 2.8 - 2.8, 0, 0
	EntityColor ball, 255, 190, 60
Next
RenderWorld
Flip
WaitKey

Media

CreateSphere

Related Commands

CreateCone, CreateCube, CreateCylinder, CreateMesh, CreateMirror, CreatePlane

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally