Skip to content

Instantly share code, notes, and snippets.

@bgK
Created December 22, 2014 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgK/d300ccdcef2048c13aea to your computer and use it in GitHub Desktop.
Save bgK/d300ccdcef2048c13aea to your computer and use it in GitHub Desktop.
diff --git a/engines/myst3/gfx_opengl_texture.cpp b/engines/myst3/gfx_opengl_texture.cpp
index 6f855ca..558ebd7 100644
--- a/engines/myst3/gfx_opengl_texture.cpp
+++ b/engines/myst3/gfx_opengl_texture.cpp
@@ -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;
@@ -83,6 +83,7 @@ OpenGLTexture::~OpenGLTexture() {
void OpenGLTexture::update(const Graphics::Surface *surface) {
glBindTexture(GL_TEXTURE_2D, id);
+
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, surface->w, surface->h, internalFormat, sourceFormat, surface->getPixels());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment