Re: [PyOpenGL-Users] Problem with numpy arrays and OpenGL textures
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@vr...> - 2008-01-05 22:03:18
|
Adeola Bannis wrote: > 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. > The problem I'm having here is that I can't reproduce your failure, as your code doesn't seem to include the failing code (though as I mentioned, the off-by-one dimensions are suspicious). I've got my float-based image displaying properly with the code I sent you. The most likely sources of segfaulting is that you're passing a non-contiguous array, or you are passing dimensions that are too large. Either one will cause OpenGL to overstep it's array bounds. In your code you are calling contiguous and then throwing away the result IIRC, any chance you intended to use those results? Good luck, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |