Archives Sept. 8, 2009
Hack to map Vertex Buffer Objects into Numpy arrays...
Written by
on
in
Snaking.
This post from the numpy list shows you how to turn a ctypes c_void_p into a numpy array. The glMapBuffer() function maps your currently-bound array into a void * which you can access directly... combining the two:
def map_buffer( vbo, access=GL_READ_WRITE ): """Map the given buffer into a numpy array...""" func = ctypes.pythonapi.PyBuffer_FromMemory func.restype = ...