Drawing objects#
This section explains how to render and interact with objects in HelloTriangle.
Which objects can be rendered?#
You can render both Mesh and Coords objects.
For meshes, all supported element types can be rendered (see Element types).
Objects are drawn using the draw() function:
draw(mymesh, name="mymesh", color="red")
draw(mycoords, name="mycoords", color="black")
Note
If you do not specify a name, a random one will be assigned automatically.
The name will appear in the Visualization Settings panel of the GUI.
Your script may contain multiple draw() statements — all corresponding objects will appear in the 3D viewer.
Choosing colors#
You can specify object colors in several ways:
Hexadecimal (string):
"#990000"Named colors (string):
"skyblue"(any of the 140 X11 color names)RGB values (string):
"rgb(255, 0, 0)"or"rgb(100%, 0%, 0%)"HSL values (string):
"hsl(0, 100%, 50%)"
GUI options#
After running a script with one or more draw() calls, all rendered objects will appear in the Visualization Settings panel on the right-hand side of the screen.
From this panel you can:
Interactively change object color
Adjust transparency
For 2D (surface) and 3D (volumetric) meshes, separately control the appearance of faces, edges, and vertices
Note
When you re-run a script, any manual changes made in the visualization settings panel will be reset.