On 2/19/08, Abdul <[EMAIL PROTECTED]> wrote:
> After changing covergl.py below line 90 into:
>
> if iChannels == 4: format = GL_RGBA
>         else: format = GL_BGR
>
> everything seems work correctly!

The problem is line 70: infinate8s: you're accessing ImageData.data
without checking the pixel format or pitch.  Change to:

id = picture.image_data
if len(id.format == 3):
    id.format = 'RGB'
else:
    id.format = 'RGBA'
id.pitch = id.width * len(id.format)
pucPixelBuffer = id.data

This will force pyglet to order the components as RGB[A] (not BGR[A]
or [A]RGB or [A]BGR, all common formats you'll see in the wild).

If you load the texture using pyglet functions this will be taken care
of automatically, and will be faster (pyglet knows about OpenGL
extensions to load e.g. BGR data directly, without needing to mush up
the data first).  Look at the pyglet.media source code for hints on
how to use pyglet's texture functions with GL_TEXTURE_RECTANGLE_ARB
(and in return, I'll look at making this more accessible in the next
version).

Cheers
Alex.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to