From 5ce6c17f7da03ef901da7d934697e76a316fb14c Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 5 Apr 2011 21:16:53 +0000 Subject: [PATCH] - try to see if this fixes an opengl bug, by retrying texture loading using older opengl API if newer fails --- .../sources/graphics/gl/texture_gl.cpp | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/source/shared_lib/sources/graphics/gl/texture_gl.cpp b/source/shared_lib/sources/graphics/gl/texture_gl.cpp index 05a5b319..4b602867 100644 --- a/source/shared_lib/sources/graphics/gl/texture_gl.cpp +++ b/source/shared_lib/sources/graphics/gl/texture_gl.cpp @@ -852,19 +852,17 @@ void Texture2DGl::init(Filter filter, int maxAnisotropy) { if(error2 == GL_NO_ERROR) { error = GL_NO_ERROR; } - else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, glFilter); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - int error3= gluBuild2DMipmaps( - GL_TEXTURE_2D, glCompressionFormat, - pixmap.getW(), pixmap.getH(), - glFormat, GL_UNSIGNED_BYTE, pixels); - if(error3 == GL_NO_ERROR) { - error = GL_NO_ERROR; - } + } + if(error != GL_NO_ERROR) { + int error3= gluBuild2DMipmaps( + GL_TEXTURE_2D, glCompressionFormat, + pixmap.getW(), pixmap.getH(), + glFormat, GL_UNSIGNED_BYTE, pixels); + if(error3 == GL_NO_ERROR) { + error = GL_NO_ERROR; } } + // if(error != GL_NO_ERROR) { @@ -1109,18 +1107,19 @@ void TextureCubeGl::init(Filter filter, int maxAnisotropy) { if(error2 == GL_NO_ERROR) { error = GL_NO_ERROR; } - else { - int error3= gluBuild2DMipmaps( - target, glCompressionFormat, - currentPixmap->getW(), currentPixmap->getH(), - glFormat, GL_UNSIGNED_BYTE, pixels); + } + if(error != GL_NO_ERROR) { + int error3= gluBuild2DMipmaps( + target, glCompressionFormat, + currentPixmap->getW(), currentPixmap->getH(), + glFormat, GL_UNSIGNED_BYTE, pixels); - if(error3 == GL_NO_ERROR) { - error = GL_NO_ERROR; - } + if(error3 == GL_NO_ERROR) { + error = GL_NO_ERROR; } } + // if(error != GL_NO_ERROR) {