I'm finding pyglet's OpenGL bindings give me at least 2 times faster
framerates than PyOpenGL's. This ratio is surprisingly high to me, am I
right to be surprised?
I'm probably doing lots wrong - I don't really know what I'm doing.
Here's what I've checked. What else should I be thinking about?
I'm setting ERROR_CHECKING=False
If I run with FULL_LOGGING then I see no extra GL calls to retrieve
I tried running with ERROR_ON_COPY=True, no errors are reported
I'm running Python with -O.
I have OpenGL-accelerate installed, although I have done nothing to
'enable' it or explicitly use it. Do I need to?
I'm drawing 500 cubes, each with a separate glDrawElements call, using:
for item in items:
item.glyph.glvertices # ctypes array of GLfloats
item.glyph.glindices # ctypes array GLushorts
(There are also color and normal array pointers defined outside the loop
- they never change.)
Where I'm defining 'gl' using:
from pyglet.gl import gl
from pyglet.gl import glu
OpenGL.ERROR_CHECKING = __debug__
OpenGL.ERROR_ON_COPY = __debug__
OpenGL.ERROR_LOGGING = False
OpenGL.FULL_LOGGING = False
from OpenGL import GL as gl
from OpenGL import GLU as glu
(obviously some function signatures aren't quite the same in pyglet and
PyOpenGL, so I'm working around those where I have to. In particular,
the definition of item.matrix passed to glMultMatrixf changes depending
on which GL bindings I use, effectively:
matrix = Matrix4() # pyeuclid, pure python
if item.position is not None:
if item.orientation is not None:
matrix *= item.orientation.get_matrix()
item.matrix = matrix_to_ctypes(matrix)
matrix = item.orientation.get_matrix() # pure python
matrix[12:15] = item.position
item.matrix = numpy.array(matrix[:], dtype=GL.GLfloat)
(this code is only run once for each item on startup - for the moment,
until I figure this out, my items never move or rotate, so the initial
matrix on each item remains constant)
I'm on WindowsXP, Python2.7, PyOpenGL3.0.1, with OpenGL2.1 ATI drivers.
(the most recent drivers available for my hardware, on both a laptop and
Jonathan Hartley Made of meat. http://tartley.com
tartley@... +44 7737 062 225 twitter/skype: tartley