title: Pyglet VBOs glVertexPointer
body: <p>I've used PyOpenGL for a long time, but now, I've switched to PyGlet.
  PyGlet is more strict the PyOpenGL, so I'm now learning it. I've written a simple code using VBOs to render a triangle(I've took the base from a PyGlet tutorial), but it doesn't works for me.   </p>
  
  <p>It shoud render a colored triangle, but instead of, It renders a white triangle. What I does wrong?</p>
  
  <p>Here's my code:</p>
  
  <pre class="lang-python prettyprint-override"><code>from pyglet.gl import *
  
  window = pyglet.window.Window()
  glEnableClientState(GL_VERTEX_ARRAY)
  vertices = [
      0,0,0,
      window.width,0,0,
      window.width,window.height,0]
  
  colors=[1.0,0.0,0.0,
          0.0,1.0,0.0,
          0.0,0.0,1.0]
  
  class VBO():
      def __init__(self):
          self.buffer=(GLuint)(0)
          glGenBuffers(1,self.buffer)
      def data(self,data):
          data_gl= (GLfloat * len(data))(*data)
          glBindBuffer(GL_ARRAY_BUFFER_ARB, self.buffer)
          glBufferData(GL_ARRAY_BUFFER_ARB, len(data)*4,
                      data_gl, GL_STATIC_DRAW)
  
      def bind(self):
          glBindBuffer(GL_ARRAY_BUFFER_ARB, self.buffer)
      def vertex(self):
          self.bind()
          glVertexPointer(3, GL_FLOAT, 0, 0)
      def color(self):
          self.bind()
          glColorPointer(3, GL_FLOAT, 0, 0) 
  
  
  
  
  vbo=VBO()
  vbo.data(vertices)
  color=VBO()
  color.data(colors)
  
  @window.event
  def on_draw():
      glClear(GL_COLOR_BUFFER_BIT)
      glLoadIdentity()
      vbo.vertex()
      color.color()
      glDrawArrays(GL_TRIANGLES, 0, len(vertices) // 2)
  
  @window.event
  def on_resize(width, height):
      glViewport(0, 0, width, height)
      glMatrixMode(gl.GL_PROJECTION)
      glLoadIdentity()
      glOrtho(0, width, 0, height, -1, 1)
      glMatrixMode(gl.GL_MODELVIEW)
  
  pyglet.app.run()
  </code></pre>
  
  <p>Thanks in advance!</p>