Selecting Color Buffers for Writing and Reading

The results of a drawing or reading operation can go into or come from any of the color buffers:

• front, back, front-left, back-left, front-right, or back-right for the default framebuffer, or

• front, or any renderbuffer attachment for a user-defined framebuffer object.

You can choose an individual buffer to be the drawing or reading target. For drawing, you can also set the target to draw into more than one buffer at the same time. You use glDrawBuffer(), or glDrawBuffers() to select the buffers to be written and glReadBuffer() to select the buffer as the source for glReadPixels(), glCopyTexImage*(), and glCopyTexSubImage*().

Get OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.