Re: [PyOpenGL-Users] Using glDrawElements on C-allocated data
Brought to you by:
mcfletch
From: René D. <re...@gm...> - 2009-06-03 11:08:41
|
Seems to be some ctypes wrappers here: http://svn.python.org/projects/ctypes/trunk/ctypeslib/ctypeslib/contrib/pythonhdr.py For the PyBuffer_FromReadWriteMemory function. If you don't want to use a C module for it. cu, On Wed, Jun 3, 2009 at 9:01 PM, René Dudfield <re...@gm...> wrote: > On Wed, Jun 3, 2009 at 8:53 PM, Gordon L. Kindlmann <gl...@uc...> wrote: >> Hello, >> >> I'm aware that most users of PyOpenGL are creating their arrays on the >> python side. >> >> In my case, I'd like to make use of a large set of pre-existing C libraries, >> which do what they do very well, and do it rapidly. This includes >> extracting features from scientific data, and representing them as polydata, >> which I'd like to visualize from python. Creating the buffers in python is >> not an option for me. Copying the data into a python array, just so I can >> hand it back to PyOpenGL, which in turn goes back through ctypes to give it >> OpenGL, is going to incur a memory and performance cost that should be >> avoided. > > sure, but can those libraries let you pass in your own allocated data? > Or are they not extensible in that way? Many C libraries let you > allocate the memory yourself, is why I asked. > > but, if you don't want to do it that way, or can't then you can create > a buffer from a pointer+size, and then use it. > > > cheers, > |