MYST3: Fix the endian-safety of the OpenGL texture loading

This commit is contained in:
Bastien Bouclet 2014-12-22 20:16:56 +01:00
parent 24b6e643b4
commit 7a3e61a9b7
3 changed files with 3 additions and 3 deletions

View File

@ -368,7 +368,7 @@ Graphics::Surface *OpenGLRenderer::getScreenshot() {
Graphics::Surface *s = new Graphics::Surface();
s->create(screen.width(), screen.height(), Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24));
glReadPixels(screen.left, screen.top, screen.width(), screen.height(), GL_RGBA, GL_UNSIGNED_BYTE, s->getPixels());
glReadPixels(screen.left, screen.top, screen.width(), screen.height(), GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, s->getPixels());
flipVertical(s);

View File

@ -437,7 +437,7 @@ Graphics::Surface *ShaderRenderer::getScreenshot() {
Graphics::Surface *s = new Graphics::Surface();
s->create(screen.width(), screen.height(), Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24));
glReadPixels(screen.left, screen.top, screen.width(), screen.height(), GL_RGBA, GL_UNSIGNED_BYTE, s->getPixels());
glReadPixels(screen.left, screen.top, screen.width(), screen.height(), GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, s->getPixels());
flipVertical(s);

View File

@ -56,7 +56,7 @@ OpenGLTexture::OpenGLTexture(const Graphics::Surface *surface, bool nonPoTSuppor
if (format.bytesPerPixel == 4) {
internalFormat = GL_RGBA;
sourceFormat = GL_UNSIGNED_BYTE;
sourceFormat = GL_UNSIGNED_INT_8_8_8_8_REV;
} else if (format.bytesPerPixel == 2) {
internalFormat = GL_RGB;
sourceFormat = GL_UNSIGNED_SHORT_5_6_5;