title: creating a rotating 3d shape in opengl with proper clipping
body: <p>I'm trying to create a triangular pyramid that rotates constantly. I've taken some code from a tutorial example to get the rotation and I think it's working, but my figure is getting clipped in the z axis. From what I've seen in a variety of tutorials, forums, etc., openGL has a default z range of (-1, 1). How can I change this to display the full extent of my figure?</p>
  
  <p>Thanks (and here's my code)</p>
  
  <pre><code>import pyglet
  
  from pyglet.gl import *
  
  rx = ry = rz = 0
  
  config = Config(sample_buffers=1, samples=4, depth_size=1000, double_buffer=True,)
  win = pyglet.window.Window(resizable=True, config=config)
  
  @win.event
  
  def update(dt):
      global rx, ry, rz
      rx += dt * 1
      ry += dt * 80
      rz += dt * 30
      rx %= 360
      ry %= 360
      rz %= 360
  pyglet.clock.schedule(update)
  
  @win.event
  def on_draw():
  
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
      glLoadIdentity()
      glTranslatef(200, 200, -4)
      glRotatef(rz, 0, 0, 1)
      glRotatef(ry, 0, 1, 0)
      glRotatef(rx, 1, 0, 0)
  
  
      glBegin(GL_TRIANGLES)
  
      glVertex3f(-100.0, 0.0, 0.0)
      glVertex3f(100.0, 0.0, 0.0)
      glVertex3f(0, 200.0, 0.0)
  
      glVertex3f(-100.0, 0.0, 0.0)
      glVertex3f(0.0, 0.0, -100.0)
      glVertex3f(0.0, 200.0, 0.0)
  
      glVertex3f(100.0, 0.0, 0.0)
      glVertex3f(0.0, 0.0, -100.0)
      glVertex3f(0.0, 200.0, 0.0)
  
      glVertex3f(-100.0, 0.0, 0.0)
      glVertex3f(0.0, 0.0, -100.0)
      glVertex3f(100.0, 0.0, 0.0)
      glEnd()
  
      glLoadIdentity()
      #glTranslatef(1.5, 0.0, -10.0)          
  
  pyglet.app.run()
  </code></pre>