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

Re: [pygame] Color problems with pygame and pyopengl?



On Thu, 18 Sep 2003 18:24, flbl@go.wifl.at.org wrote:
> I was having some problems saving an image from a program that i was
> writing, and made this test program to see what was going on.
> On two different systems, this seems to show a colorwheel, but when i
> save a screenshot (down arrow), the colors are not right (green channel
> is copied over blue channel?).

Use glreadpixels() to get the data, I hit this last night while doing some 
test programming - I think the standard pygame.display.get_surface() approach 
may have a bug with using signed bytes instead of unsigned, or maybe it's 
just an artifact of opengl under windows, anyway the ReadPixels method does 
seem to work correctly.

you can convert the resulting array from RGBA (or RGB) to an image with 
pygame.image.fromstring() - you will probably need to set the flipped flag to 
1.

You will notice that both methods are DOG SLOW - I can render 512x128 screen 
at 1380FPS drawing on crappy opengl hardware, and this drops to 26FPS when 
capturing in RGBA to memory - a 'feature' of most current opengl hardware :(

Stuart W.