Specify different glClearColor for multiple frame buffer attachments


I’ve been wondering if there is a way to specify different clear color for every frame buffer attachment. Currently Im using a frame buffer with few texture targets, and I need at least one of them to have a different clear color.

I’ve seen an approach using glDrawBuffer, glClearColor and then glClear on every desired target, but that seems a little inefficient to me, so I’ve been wondering - is there is a way to set clear colors for few attachments, that only require single glClear call? Or am I wrong, and that in fast is not inefficient at all?


No. But instead of using glClear, you can call glClearBuffer for each attachment, specifying the clear value as an argument. This is also the only way to clear integer and floating-point buffers with a value outside the range [0,1].