Gez
Why don't I have a custom title by now?!
Posts: 9148
Registered: 07-07 |
_bruce_ said:
-The load snapshot gets distorted and is black and white.
http://i.imgur.com/toIn1.png
That one is easy to solve. I had to fix that in the screenshot code in GZDoom some times ago. You need to call
code: glPixelStorei(GL_PACK_ALIGNMENT, 1);
before taking the snapshot, and then once it is taken call
code: glPixelStorei(GL_PACK_ALIGNMENT, 4);
to return to normal for performances purposes.
The problem happens when image widths aren't a multiple of four. Here the resolution for the snapshot appears to be 341x256.
Since the image data isn't aligned on four bytes, when you read the renderbuffer's pixels to store them in a picture, you get out of alignment visually. So you have to tell it to use a 1-byte alignment. But it is apparently costly for performances, so you want to return to the default of 4-byte alignment once you've finished reading the pixels.
|