#include "image.h"
#include "opengl.h"
#include "imago2.h"
+#include "opt.h"
#if defined(GL_ES_VERSION_2_0) || defined(GL_VERSION_3_0)
#define USE_GL_GENERATE_MIPMAP
static int glifmt_from_imgfmt(Image::Format fmt)
{
+ bool use_srgb = GLEW_EXT_texture_sRGB && opt.srgb;
+
switch(fmt) {
case Image::FMT_GREY:
- return GLEW_EXT_texture_sRGB ? GL_SLUMINANCE : GL_LUMINANCE;
+ return use_srgb ? GL_SLUMINANCE : GL_LUMINANCE;
case Image::FMT_GREY_FLOAT:
return GL_LUMINANCE16F;
case Image::FMT_RGB:
- return GLEW_EXT_texture_sRGB ? GL_SRGB : GL_RGB;
+ return use_srgb ? GL_SRGB : GL_RGB;
case Image::FMT_RGB_FLOAT:
return GL_RGB16F;
case Image::FMT_RGBA:
- return GLEW_EXT_texture_sRGB ? GL_SRGB_ALPHA : GL_RGBA;
+ return use_srgb ? GL_SRGB_ALPHA : GL_RGBA;
case Image::FMT_RGBA_FLOAT:
return GL_RGBA16F;