[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] pygame.surfarray.pixels2d does not work with OpenGL?



Hi,
 
Function tostring unmaps each pixel into an RGBA sequence, with the R byte lowest. Function pixels2d returns a view of the actual surface memory. A 32 bit source alpha surface need not, and probably does not, have pixels in an RGBA order.
 
Lenard Lindstrom
 
On Oct 31, 2011, Florian Krause <siebenhundertzehn@xxxxxxxxx> wrote:
Hi everyone,

can anyone tell me what I am doing wrong here?
Please have a look at the attached example code.

When using pygame,image.tostring for getting the pixel values to
transform them into a texture, everything works well (see the
outcommented part with WORKS).

However, when I replace this part with pygame.surfarray.pixels2d, then
the resulting texture seems broken for some reason.

Does anyone have an idea what is going on here?

Thanks in advance,
Florian