1

I'm using OpenGL ES 3 on Android, and I'm trying to load an sRGB texture and generate mipmaps for it. I'm using GL_SRGB8 for the internal format, generate mipmaps with glGenerateMipmap(GL_TEXTURE_2D), and use GL_LINEAR_MIPMAP_LINEAR. When I try to use it, it draws a black texture.

If I use GL_RGB8 instead, it works. If I don't attempt to use mipmaps, GL_SRGB8 works. I've also run the same code on desktop OpenGL, and it also works. Is there a way to get this to work in OpenGL ES?

1 Answers1

4

Generating mipmaps on the GPU requires the color format to be both filterable (to create the downsamples) and renderable (to write the output image). sRGB is not guaranteed to be a renderable format in the specification (Table 8.10 in the GLES 3.2 spec).

You'll have to generate mipmaps on the CPU and upload them manually.

solidpixel
  • 10,688
  • 1
  • 20
  • 33