[Image-SIG] Using PIL for background display in OGL/Python
bob at redivi.com
Fri Jan 28 22:58:29 CET 2005
On Jan 28, 2005, at 12:26, <python at bnardone.com> wrote:
> 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:
> 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
> to no avail.
> Is this possible? Am I headed in the right direction?
You shouldn't be using glDrawPixels.. it's almost always slow. You
want to draw it to a texture, and then render the texture to a rect.
There are examples out there for getting a PIL image into an OpenGL
texture, but I can't think of anything off the top of my head.
More information about the Image-SIG