title: (python) pygame opengl is much slower than blitting
body: <p>I just implemented basic opengl rendering into my pygame application thinking hardware acceleration would make the program run faster. It is much, much slower instead.</p>
  
  <p>Looks like the problem is the drawing function. </p>
  
  <p>Here is my opengl drawing function</p>
  
  <pre><code>    def draw(self, screen):
          rect = self.texture.imagerect.copy()
          rect.x += self.xoffset
          rect.y += self.yoffset
  
          halfWidth = self.getWidth()/2
          halfHeight = self.getHeight()/2
  
          glEnable(GL_TEXTURE_2D)
  
          glBindTexture(GL_TEXTURE_2D, self.texture.getTexID()) 
  
          self.color.setGLColor()
  
          glPushMatrix()
  
          glTranslatef(rect.x,rect.y,0)
  
          glRotatef(self.angle, 0, 0, 1);
  
          glBegin(GL_QUADS)
  
          glTexCoord2d(0,0)
          glVertex2f(-halfWidth + self.pivot.x, -halfHeight + self.pivot.y)
  
          glTexCoord2d(0,1)
          glVertex2f(-halfWidth + self.pivot.x,-halfHeight + self.getHeight() + self.pivot.y)
  
          glTexCoord2d(1,1) 
          glVertex2f(-halfWidth + self.getWidth() + self.pivot.x,-halfHeight + self.getHeight() + self.pivot.y)
  
          glTexCoord2d(1,0)
          glVertex2f(-halfWidth + self.getWidth() + self.pivot.x,-halfHeight + self.pivot.y)
  
          glEnd()
  
          glPopMatrix()
  </code></pre>
  
  <p>what my profiler gives for the draw function</p>
  
  <pre><code>ncalls  tottime  percall  cumtime  percall filename:lineno(function)
  312792   20.395    0.000   34.637    0.000 image.py:61(draw)
  </code></pre>
  
  <p>the rest of my profiler text: (expires in 1 month)</p>
  
  <p><a href="http://pastebin.com/ApfiCQzw" rel="nofollow">http://pastebin.com/ApfiCQzw</a></p>
  
  <p>my sourcecode </p>
  
  <p><a href="https://bitbucket.org/claysmithr/warbots/src" rel="nofollow">https://bitbucket.org/claysmithr/warbots/src</a></p>
  
  <p>Note: when i set it to not draw any tiles i get 60 fps! I also get 20 fps if i limit to only draw tiles that appear on the screen, but this is still much slower than blitting</p>
  
  <p>Number of tiles i'm trying to draw (64x64):  15,625</p>
  
  <p>Is there any way to test if I am really hardware accelerated?</p>
  
  <p>Should I just go back to blitting?</p>
  
  <p>edit: Does blitting automatically not draw tiles that are not on the screen? that could be the reason why opengl is being so slow!</p>