Re: [PyOpenGL-Users] Format of New glReadPixels
Brought to you by:
mcfletch
|
From: Ian M. <ia...@ge...> - 2013-08-17 05:56:52
|
On Mon, Jul 8, 2013 at 7:24 AM, Mike C. Fletcher <mcf...@vr...>wrote: > > Is there a workaround available for current implementations? > You can pass the array in explicitly (param array), then convert it on > output (.tostring() for numpy). If you have numpy installed and the > code isn't picking it up, then we have another failure case :( . You > could also just copy the wrapper function from bzr into your code, it's > just a regular python function wrapper; however, if you have numpy, then > it should have picked that up as your default output array format > (generic preferences are numpy, numeric, ctypesarrays, and since *noone* > has Numeric any more, that's just numpy or ctypes arrays). > > You can *explicitly* set your preferred handler with > OpenGL.arrays.arraydatatype.ArrayDatatype.registerReturn( 'numpy' ), but > since that's the default anyway, it *shouldn't* make a difference, and > it will still try the others if it can't find your preferred format. > > My guess is that numpy isn't importable/usable, and you fell through to > the ctypes arrays. If not, we need to spelunk. > The numpy on my machine is seriously broken--which might be due to a nonstandard Python setup. I'm on Windows, and all the Pythons wanted to install themselves to the registry in the same place. I fussed around with it a while ago, and now double-clicking on a file runs it with Python 2.7, while IDLE is Python 3.3. In fact, if I recall correctly, the NumPy installers that come for Windows couldn't find *any* Python on the computer at all, nor would they let me tell them where it was. I was annoyed about the whole thing, but didn't (and still don't) have time to untangle the mess. May I recommend a feature to convert the result directly to a Python string or something for those of us without NumPy? HTH, > Mike > Thanks, Ian |