From 36e99b4880fbeb97eef9a2f79b2317c8fcb5d823 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 9 Feb 2015 21:46:56 -0400 Subject: [PATCH] Fix an OpenGL error when an sRGB image is created with mipmaps in OpenGL ES 2. --HG-- branch : minor --- src/modules/graphics/opengl/Image.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/graphics/opengl/Image.cpp b/src/modules/graphics/opengl/Image.cpp index 42f4be65d..4e93b674c 100644 --- a/src/modules/graphics/opengl/Image.cpp +++ b/src/modules/graphics/opengl/Image.cpp @@ -310,6 +310,13 @@ bool Image::loadVolatile() { if (flags.sRGB && !hasSRGBSupport()) throw love::Exception("sRGB images are not supported on this system."); + + // GL_EXT_sRGB doesn't support glGenerateMipmap for sRGB textures. + if (flags.sRGB && (GLAD_ES_VERSION_2_0 && GLAD_EXT_sRGB && !GLAD_ES_VERSION_3_0)) + { + flags.mipmaps = false; + filter.mipmap = FILTER_NONE; + } } // NPOT textures don't support mipmapping without full NPOT support.