From fc94a3246a7ba26bf49205941a65e3acc3adb800 Mon Sep 17 00:00:00 2001 From: Alejandro Marzini Date: Sat, 31 Jul 2010 19:20:33 +0000 Subject: OPENGL: Fix texture updating. svn-id: r51549 --- backends/graphics/opengl/gltexture.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'backends/graphics/opengl/gltexture.cpp') diff --git a/backends/graphics/opengl/gltexture.cpp b/backends/graphics/opengl/gltexture.cpp index d7a1b0a236..7514fd0662 100644 --- a/backends/graphics/opengl/gltexture.cpp +++ b/backends/graphics/opengl/gltexture.cpp @@ -142,10 +142,10 @@ void GLTexture::updateBuffer(const void *buf, int pitch, GLuint x, GLuint y, GLu glBindTexture(GL_TEXTURE_2D, _textureName); CHECK_GL_ERROR(); // Check if the buffer has its data contiguously - /*if (static_cast(w) * _bytesPerPixel == pitch) { + if (static_cast(w) * _bytesPerPixel == pitch && w == _textureWidth) { glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, _glFormat, _glType, buf); CHECK_GL_ERROR(); - } else {*/ + } else { // Update the texture row by row const byte *src = static_cast(buf); do { @@ -154,7 +154,7 @@ void GLTexture::updateBuffer(const void *buf, int pitch, GLuint x, GLuint y, GLu ++y; src += pitch; } while (--h); - //} + } } void GLTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) { -- cgit v1.2.3