3D Primitives
3D primitive methods allow you to render simple geometric shapes directly into a display’s 3D scene.
Before drawing 3D objects, ensure that the display camera has been configured using setupCamera.
Methods
Section titled “Methods”clear3D
Section titled “clear3D”Clears all 3D rendering state for the display.
Use this when resetting a 3D scene.
Requires: DisplayID
Example
Section titled “Example”gpu.clear3D(displayId)drawCube
Section titled “drawCube”Draws a colored cube in 3D space.
Rotation values are specified in degrees:
rotX- rotation around the X axisrotY- rotation around the Y axisrotZ- rotation around the Z axis
Requires: DisplayID, position, size, rotation, and RGB color values.
Example
Section titled “Example”gpu.drawCube( displayId, 0, 0, 0, 2, 0, 45, 0, 255, 100, 100)drawPyramid
Section titled “drawPyramid”Draws a colored pyramid in 3D space.
Rotation values are specified in degrees:
rotX- rotation around the X axisrotY- rotation around the Y axisrotZ- rotation around the Z axis
Requires: DisplayID, position, size, rotation, and RGB color values.
Example
Section titled “Example”gpu.drawPyramid( displayId, 0, 0, 0, 2, 0, 45, 0, 255, 255, 0)drawSphere
Section titled “drawSphere”Draws a sphere in 3D space.
The segments parameter controls sphere detail:
- lower values use fewer polygons and render faster
- higher values create smoother spheres but require more rendering work
textureNameObj is used for texture-related rendering if supported.
Requires: DisplayID, position, radius, segments, RGB color values, texture object.
Example
Section titled “Example”gpu.drawSphere( displayId, 0, 0, 0, 1, 16, 100, 180, 255, nil)