GL_EXT_draw_buffers

Supported Hardware

Series5XT, Series6, Series6XE, Series6XT

Valid APIs

OpenGL ES 2.0

Description

Typically, only one colour output is enabled by default in OpenGL ES 2.0, and whilst querying for additional colour buffers has exists, the base OpenGL ES 2.0 specification does not allow for additional colour buffers. This extension adds language and functionality that enable up to a maximum of 16 total colour buffers per framebuffer object, though the actual available number varies by platform. The main benefit of this extension is to reduce the number of draw passes in a scene, as a number of techniques need more than 4 channels of data to output for a given scene, usually for further calculation. Without additional colour buffers, developers are forced to render the same data multiple times or sacrifice precision by packing data.

This functionality is also more commonly known as "Multiple Render Targets" or MRTs.

Note

This functionality is core to OpenGL ES 3.0.

Example

// Attach a texture to a framebuffer, using a colour attachment beyond 0. 
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, aTextureColourBuffer, 0); 
// The writable draw buffers also need to be set separately. In this instance there are two 
// colour buffers. Create a list and allow them to be rendered to. 
GLenum buffers[2] = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1}; 
glDrawBuffers(2, buffers);