[PyOpenGL-Users] Building an interleaved buffer for pyopengl
Brought to you by:
mcfletch
From: Nick S. <ni...@so...> - 2010-06-30 14:04:40
|
Hello! (Full disclosure: I actually posted this on stackoverflow a few months ago but I didn't really receive a good response. url: http://bit.ly/a8W5hR ) I have a series of sprite objects rendering to textured quads. Right now they all have individual render() methods which return an interleaved buffer. I call them all in order and batch these vertices and texture coords before sending to pyOpengl's glInterleavedArrays/glDrawArrays. Is there a better way to be doing this? The fastest way seems to be generating a python list and converting to a numpy array later which doesn't seem right. Thankyou for any help? I have attached some example code and their timings. Timings using random numbers on my machine: $ python testing2.py from list: 9.02473926544 ms array: indexed: 14.8707222939 ms array: slicing: 30.3278303146 ms array: concat: 26.5012693405 ms array: put: 45.0277900696 ms ctypes float array: 26.240530014 ms - Nick |