androidopengl-esfbomultisampling

Multisampled FBO's in OpenGL ES 3.0


How is it possible to have a multisampled texture as part of an FBO in OpenGL ES 3.0 (Android)?

The method glTexImage2DMultisample does not seem to exist.

I also want to call glReadPixels on this texture later on in this code, so the multisampled texture should also be readable.

Is there some kind of extension or utility I would need to use for this?


Solution

  • You want glTexStorage2DMultisample. In general writing multisampled data back to memory is expensive, and needs a resolve using glBlitFramebuffer to consolidate to a single sample.

    Consider using this extension to get a "free" resolve on most tile-based architectures.

    https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_multisampled_render_to_texture.txt