Python 2.6+ buffer protocol...
Last update on .
Been playing around with the Python 2.6+ buffer protocol this morning. Notes:
- it appears that ctypes could support buffer-supporting objects being passed as pointers natively (i.e. at C speed), but it doesn't seem to (at least with my cursory tests) there would likely be a lot of corner cases that would need to throw errors
- there doesn't seem to be a hook at the Python level to say "my object can fill in a buffer on demand"?
- the constants and one of the "functions" are defined as macros, so not ctypes-friendly for working with them
there are still some things that the array protocol in PyOpenGL provides that aren't there at the moment.
- support for lists/tuples of equal-typed values (this isn't supported if you turn on ERROR_ON_COPY anyway)
- ways for (python coded) objects to participate in the protocol (e.g. a wrapper object such as a VBO that passes "special" pointers (actually offsets))
- ctypes parameter types that can access other parameters *after* conversion to buffer types (e.g. to get the dimensions of another argument)
Pingbacks are closed.
Comments are closed.