Re: [PyOpenGL-Users] Problems with glReadPixels
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@vr...> - 2007-07-01 03:44:26
|
Dirk Reiners wrote: ... > But now I have some other questions concerning glReadPixels: I'm a little > confused about the return types. Adding the following to cube.py:display > > data = glReadPixelsub(0, 0, 1, 1, GL_RGB) > print data, type(data[0][0][0]) > data = glReadPixelsb(0, 0, 1, 1, GL_RGB) > print data, type(data[0][0][0]) > data = glReadPixelsui(0, 0, 1, 1, GL_RGB) > print data, type(data[0][0]) > data = glReadPixelsi(0, 0, 1, 1, GL_RGB) > print data, type(data[0][0]) > data = glReadPixelsf(0, 0, 1, 1, GL_RGB) > print data, type(data[0][0]) > > gives me > > [[[0 0 0]]] <type 'numpy.int8'> > [[[0 0 0]]] <type 'numpy.int8'> > [[0]] <type 'numpy.int32'> > [[0]] <type 'numpy.int32'> > [[ 0.]] <type 'numpy.float32'> > > Why do I get signed integers in each case? I would have expected unsigneds for > the ub/ui cases. > It's a bug, I didn't realise that numpy had added unsigned versions of the int types so the code was doing the same as it did for Numeric. I've added support for them on my local machine, will push it out on the next alpha release. > Why do I get only a 2D array for the i/ui/f cases? I would have expected the > usual RGB triple. > You're getting all three colours in a single integer IIUC, that is, you're seeing an integer with bits 0-8 with colour 1, 1-16 with colour two etceteras. > P.S.: Can you please close our bug? No clue why it showed up 5 times. > Will do so when I sit down to work on the project. Take care, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |