GLDRAWBUFFER(3G)
๐
GLDRAWBUFFER(3G) โ aka the glDrawBuffer era ๐
Okay bestie, so this is a page from the OpenGL manual, section 3G. Sit down, grab a strawberry drink ๐, and let me tell you about the moment where your app decides where the colors actually land. It's giving "which mailbox do I drop this letter in" but make it graphics.
โจ C SPECIFICATION โจ
void glDrawBuffer( GLenum mode )
Like, one function, one argument, zero vibes spared. ๐ซถ
๐ธ PARAMETERS ๐ธ
modeโ tells the universe up to four color buffers to be drawn into. The symbolic constants it accepts areGL_NONE,GL_FRONT_LEFT,GL_FRONT_RIGHT,GL_BACK_LEFT,GL_BACK_RIGHT,GL_FRONT,GL_BACK,GL_LEFT,GL_RIGHT,GL_FRONT_AND_BACK, andGL_AUXi, where i is between0and"GL_AUX_BUFFERS" - 1. And before you @ me:GL_AUX_BUFFERSis not the upper limit โ useglGetto query the number of available aux buffers, iykyk. The initial value isGL_FRONTfor single-buffered contexts, andGL_BACKfor double-buffered contexts.
๐ฆ DESCRIPTION ๐ฆ
So like, when colors are written to the frame buffer, they get written into the color buffers that glDrawBuffer picks. The specs are as follows, and yes I'm listing all of them, no cap:
GL_NONEโ No color buffers are written. None. Zero. Empty. ๐GL_FRONT_LEFTโ Only the front left color buffer is written.GL_FRONT_RIGHTโ Only the front right color buffer is written.GL_BACK_LEFTโ Only the back left color buffer is written.GL_BACK_RIGHTโ Only the back right color buffer is written.GL_FRONTโ Only the front left and front right color buffers are written. If there is no front right color buffer, only the front left color buffer is written.GL_BACKโ Only the back left and back right color buffers are written. If there is no back right color buffer, only the back left color buffer is written.GL_LEFTโ Only the front left and back left color buffers are written. If there is no back left color buffer, only the front left color buffer is written.GL_RIGHTโ Only the front right and back right color buffers are written. If there is no back right color buffer, only the front right color buffer is written.GL_FRONT_AND_BACKโ All the front and back color buffers (front left, front right, back left, back right) are written. If there are no back color buffers, only the front left and front right color buffers are written. If there are no right color buffers, only the front left and back left color buffers are written. If there are no right or back color buffers, only the front left color buffer is written. The way this one has layers ๐ญ๐GL_AUXiโ Only auxiliary color buffer i is written.
Now the spicy part ๐ถ๏ธ: if more than one color buffer is selected for drawing, then blending or logical operations are computed and applied independently for each color buffer and can produce different results in each buffer. Main character energy per buffer, honestly.
Monoscopic contexts include only left buffers, and stereoscopic contexts include both left and right buffers. Likewise, single-buffered contexts include only front buffers, and double-buffered contexts include both front and back buffers. The context is selected at GL initialization. Periodt.
๐ NOTES ๐
It is always the case that GL_AUXi = GL_AUX0 + i. Math stays mathing. ๐งฎโจ
๐ ERRORS ๐
GL_INVALID_ENUMis generated ifmodeis not an accepted value.GL_INVALID_OPERATIONis generated if none of the buffers indicated bymodeexists.GL_INVALID_OPERATIONis generated ifglDrawBufferis executed between the execution ofglBeginand the corresponding execution ofglEnd.
Not me getting an error because I called it in the middle of aglBegin/glEndblock ๐ Don't be that girl.
๐ ASSOCIATED GETS ๐
glGetwith argumentGL_DRAW_BUFFERglGetwith argumentGL_AUX_BUFFERS
๐ฅ SEE ALSO ๐ฅ
glBlendFunc(3G), glColorMask(3G), glIndexMask(3G), glLogicOp(3G), glReadBuffer(3G)
Okay that's the whole page, bestie โ every flag, every fallback case, every error, all of it. Slay. ๐
Sign-off time: this one's from the OpenGL manual, section GLDRAWBUFFER(3G), and the footer of the original was the same GLDRAWBUFFER(3G) marker. Go draw into your buffers responsibly, queen ๐๐ฆ๐
๐ฆ where this page comes from
- opensuse-leap 16.0: Mesa-libGL-devel 24.1.7-160000.3.1 ยท MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 ยท MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 ยท MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 ยท MIT
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms