GL_EXT_multisampled_render_to_texture2#
Supported Hardware#
Series5XT, Series6, Series6XE, Series6XT
Valid APIs#
OpenGL ES 1.x, 2.0, 3.x
Description#
Extends GL_EXT_multisampled_render_to_texture to allow multiple colour attachments and depth/stencil attachments. The attachment parameter for the command FramebufferTexture2DMultisampleEXT introduced in EXT_multisampled_render_to_texture no longer needs to be COLOR_ATTACHMENT0, matching what is allowed in FramebufferTexture2D. Values like GL_COLOR_ATTACHMENTi, GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT, or GL_DEPTH_STENCIL_ATTACHMENT may be used.
Registry Link#
https://registry.khronos.org/OpenGL/extensions/EXT/EXT_multisampled_render_to_texture2.txt
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);