code: def __init__(self):
      app.Canvas.__init__(
          self,
          size=(512, 512),
          title="Colored instanced cube",
          keys="interactive",
      )
  
      # Build cube data
      V, I, _ = create_cube()
      vertices = VertexBuffer(V)
      self.indices = IndexBuffer(I)
  
      instance_shift = VertexBuffer(
          ((np.random.rand(100, 3) - 0.5) * 50).astype(np.float32),
          divisor=1,
      )
      instance_color = VertexBuffer(
          np.random.rand(5, 3).astype(np.float32), divisor=20
      )
  
      # Build program
      self.program = Program(vertex, fragment)
      self.program.bind(vertices)
  
      # Build view, model, projection & normal
      view = translate((0, 0, -100))
      model = np.eye(4, dtype=np.float32)
      self.program["model"] = model
      self.program["view"] = view
      self.program["instance_shift"] = instance_shift
      self.program["instance_color"] = instance_color
      self.phi, self.theta = 0, 0
      gloo.set_state(
          clear_color=(0.30, 0.30, 0.35, 1.00), depth_test=True
      )
  
      self.activate_zoom()
  
      self.timer = app.Timer("auto", self.on_timer, start=True)
  
      self.show()
  
file_path: vispy/examples/gloo/colored_cube_instanced.py
imports: import numpy
  from vispy import app, gloo, use
  from vispy.gloo import Program, VertexBuffer, IndexBuffer
  from vispy.util.transforms import perspective, translate, rotate
  from vispy.geometry import create_cube
label_desc: Use image node_id 1 to create a new Canvas object from inherited base classes: app with example: obj = Canvas()