code: def __init__(self):
      app.Canvas.__init__(self, keys="interactive", size=(800, 600))
  
      self.vertices, self.filled, self.outline = cube()
      self.filled_buf = gloo.IndexBuffer(self.filled)
      self.outline_buf = gloo.IndexBuffer(self.outline)
  
      self.program = gloo.Program(vert, frag)
      self.program.bind(gloo.VertexBuffer(self.vertices))
  
      self.view = translate((0, 0, -5))
      self.model = np.eye(4, dtype=np.float32)
  
      gloo.set_viewport(
          0, 0, self.physical_size[0], self.physical_size[1]
      )
      self.projection = perspective(
          45.0, self.size[0] / float(self.size[1]), 2.0, 10.0
      )
  
      self.program["u_projection"] = self.projection
  
      self.program["u_model"] = self.model
      self.program["u_view"] = self.view
  
      self.theta = 0
      self.phi = 0
  
      gloo.set_clear_color("white")
      gloo.set_state("opaque")
      gloo.set_polygon_offset(1, 1)
  
      self._timer = app.Timer("auto", connect=self.on_timer, start=True)
  
      self.show()
  
file_path: vispy/examples/gloo/rotate_cube.py
imports: import numpy
  from vispy import app, gloo
  from vispy.util.transforms import perspective, translate, rotate
label_desc: Use image node_id 1 to create a new Canvas object from inherited base classes: app with example: obj = Canvas()