Ctypes arrays as storage format (Seems natural given the implementation...)


Today (and yesterday) I added support for making ctypes arrays first-class array-storage formats for OpenGL-ctypes. That is, you can do this:
import OpenGL
OpenGL.preferredArray( 'ctypesarrays' )

Before you import OpenGL functions in your application and array-producing calls will then use ctypes arrays for the produced arrays (i.e. glGet* will return ctypes arrays instead of Numpy ones). Of course, it also works that you can pass in a ctypes array as an array argument.

Update: also added support for ctypes.POINTER instances, so that you can pass in a raw ctypes pointer for C-style APIs. Note that you can't use these as output data-types, however, and most PyOpenGL-style figure-it-out-from-the-data APIs aren't going to work with them.

Comments

Comments are closed.

Pingbacks

Pingbacks are closed.