You may want to try using Cython, rather than raw C.
We've been meaning to investigate Cython. We use C/C++ libraries and ctypes today. One advantage of C is that other C/C++ programs can use the libraries. But I'm interested in trying Cython just to learn about it.
> Rather than pull it into Python and then push itwell, I don't know that I'd do it for this reason -- if you pull/push
> back with pyopengl, it seems like we could just draw it from C, if that
> is allowed.
the data as numpy arrays, you can do all that without data copying, so
keeping it in Python may be fine.
You might be right.
How do you completely avoid the copy? I do something really simple/dumb when right now when I need to return an array from C to Python. I do use numpy, but I do the allocation in Python and then hand the empty array to C to copy the values into.
I saw some stuff about defining an allocator but it looked complicated.
I wonder if my simplistic approach if the copy would hurt me. I wonder if I should be using a better no-copy approach instead.
Anyway probably I should start by keeping drawing in Python and if/when I measure a real performance problem consider pushing it to C. This is how we operate with other stuff, resorting to C only to solve a specific performance issue.