Re: [PyOpenGL-Users] Problem with numpy arrays and OpenGL textures
Brought to you by:
mcfletch
From: Adeola B. <the...@gm...> - 2008-01-05 19:31:30
|
Thanks Mike, It wasn't so much a script I sent as a class definition. There probably should have been some main function for testing, but I didn't feel like writing up the wxApp. I don't currently have OpenGLContext installed, so I can't (yet) directly run your code. The +1 in the dimensions were necessary in my code before, at least in the horizontal direction - otherwise the image had a characteristic "twist". I had already tried it without them, but with little improvement. If you're interested I've attached the image I get with pylab.imshow() and the image I get on my GLCanvas. I tried the image.ctypes.data_as() conversion, but then my program segfaults whenever it gets to the gluBuild2DMipmaps call. On Jan 4, 2008 3:56 PM, Mike C. Fletcher <mcf...@vr...> wrote: > When I alter your code to actually run (the attached script doesn't seem > to do anything) I wind up with a working script. It does point to a bug > in the current PyOpenGL 3.0.0b1's handling of void pointer arrays (they > are supposed to auto-convert numpy arrays, but I had to explicitly > extract a void pointer to make it work). I note that your spec for the > image size is wrong, you're adding 1 to the dimensions, which should not > be necessary, and could have the effect you described (garbled, with > black pixels). > > I've attached what I'm running, so you can point out what's different. > > Enjoy, > Mike > > -- > ________________________________________________ > Mike C. Fletcher > Designer, VR Plumber, Coder > http://www.vrplumber.com > http://blog.vrplumber.com > > |