Enable or disable transparency. Transparency is disabled by default.

Be sure to render all non-transparent objects first. Otherwise the color blending will be off.

Generally, when rendering with transparency your display function will be structured like this:

  • disable transparency, enable lighting, set material properties, etc.
  • draw all opaque objects
  • enable transparency, turn off lighting, set color poperties
  • draw all transparent objects

syntax

transparency(enable)

parameters

enable True or False

examples

draw a transparent sphere

def display():
   lighting(False)

   color(0.0, 1.0, 0.0)
   sphere(5.0)

   transparency(True)
   color(0.0, 1.0, 0.0, 0.3)
   sphere(5.0, style="solid")