Bit of PyOpenGL on the weekend

Spent much of the afternoon working on PyOpenGL.  Spent some quality time with kcachegrind and got something like a 1% speed up on a (rather dumb) benchmark I've been using (dumb because it does everything wrong, mostly).  In doing so I cut down on the amount of code in the "wrapper" module noticeably, which was the primary value in the work.  We're seeing about 7.5% of run-time in PyOpenGL overhead on that particular demo, but again, it does rather unlikely things, like using glBegin/glEnd geometry all over the place.

Also spent quite a while trying to figure out how to get glMultiDrawElements wrapped.  This is a weird little API that asks for a GLvoid ** as a parameter.  I originally thought this should be a two-dimensional contiguous array, but reading around the net it's apparently an array of pointers to the indices.  Basically the definition is:

def glMultiDrawElements(primtype, counts, typ, indices, primcount):
for i in range( primcount ):
glDrawElements( primtype, counts[i], typ, indices[i] )

with the idea that each element in indices is an array of typ (GL_UNSIGNED_BYTE here).  Problem is that I can run the pseudo-code there fine for the input values, but it doesn't work with the C-coded version :( .

It's got to be something low-level and obvious, but at the moment I'm not seeing it.  Ah well, another day.


Comments are closed.


Pingbacks are closed.