[Image-SIG] Using PIL for background display in OGL/Python

python at bnardone.com python at bnardone.com
Fri Jan 28 12:26:48 CET 2005


I've just begun working OGL with Python and had a question about PIL.
Specifically, I've been using it to load .png's as textures, and now have a need
to draw other images (.jpg, .png) as background images. I'm interested in using
something along the lines of:
glPixelStorei(GL_UNPACK_ALIGNMENT,4);
glRasterPos2i(0,600)
glDrawPixels(800,600,GL_RGBA,*someBitmapSet*)

But I am unsure as to how to get the *someBitmapSet* out of the object returned by
someImage.tostring("raw", "RGBA", 0, -1)
image = numarray.array(numarray.fromstring(image, numarray.Byte))

I've tried
glDrawPixels(800,600,GL_RGBA,GL_UNSIGNED_BYTE,image)
to no avail.

Is this possible? Am I headed in the right direction?





More information about the Image-SIG mailing list