GL_EXT_multisampled_render_to_texture#

Supported Hardware#

Series5XT, Series6, Series6XE, Series6XT

Valid APIs#

OpenGL ES 1.x, 2.0, 3.x

Description#

This extension adds multisampled rendering capabilities to OpenGLES, allowing a user to create multisampled render buffers, and attach textures to a framebuffer in a way that they can be used for multisampled renders. By enabling textures to be attached as multisampled but without using actual multisample textures, a significant amount of bandwidth can be saved. This mode of operation enables multisampled anti-aliasing to smooth lines at the edges of polygons and reduce the appearance of jagged lines. This is functionally equivalent to GL_IMG_multisampled_render_to_texture on PowerVR hardware.

Note#

Part of this functionality is core to OpenGL ES 3.0. The renderbuffer functionality is present in core, however, the multisampled texture attachment is not.

Example#

// Create a multisampled depth renderbuffer
GLint depthBuffer = glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 4, GL_DEPTH_COMPONENT16, 1024, 1024);
// Attach the renderbuffer to the framebuffer as per usual. Note: If one attachment is
// multi-sampled, all attachments need to be. If there is a mix, the framebuffer will be
// incomplete.
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthBuffer);
// Create a regular colour buffer (texture). This extension doesn't introduce multi-sample
// textures, instead attaching regular textures that multi-sampling will resolve to before
// writing out.
GLint colourBuffer = glTexStorage(GL_TEXTURE_2D, 1, GL_RGBA8, 1024, 1024);
// Attach it to a framebuffer as multisampled, so that OpenGL ES knows that it should resolve
// a multisampled render to this texture.
glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colourBuffer, 0);