Re: [PyOpenGL-Users] Problem with numpy arrays and OpenGL textures
Brought to you by:
mcfletch
From: Dirk R. <di...@li...> - 2008-01-08 16:00:46
|
Hi Adeola, Adeola Bannis wrote: > Well, > > Now I have a recognisable image that just seems to be "twisted funny" > (not again...), after I decided to use GL_UNSIGNED_BYTE instead of > GL_FLOAT. I think the strange orientation of my picture might just be > due to placing the corners in the wrong order or some such. Last time, > I resolved the whole "twisted funny" problem with an offset of +/-1. > It's also a bit dark, but that's definitely fixable. Here's a picture > of the "funny looking" image to compare to the "good" image I sent > earlier. > > Thank you so much for all your help - I think the ctypes call made the > difference between rendering gook and rendering the texture. I don't have much experience with PyOpenGL, but I do with OpenGL, so take the following with a grain of salt. The most common reason for 'twisted funny' images is forgetting to set GL_PACK_ALIGNMENT resp. GL_UNPACK_ALIGNMENT to 1 in glPixelStore. By default OpenGL assumes image rows to start on 32-bit aligned addresses, which for RGB byte images is only true if the width is a multiple of 4. Hope it helps Dirk |