PDA

View Full Version : Clearing 4 draw buffers at once



Verdagon
02-04-2011, 09:07 PM
Hi all, I have an FBO with a depth buffer and four color buffers (two RGBA16F and two LUMINANCE32F). Google says that if I call glClear with GL_COLOR_BUFFER_BIT, it clears all four color buffers at once. This doesn't agree with my experiments though.

If I do this:


beginFBO();
GLenum drawBuffers[4] = {
GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1,
GL_COLOR_ATTACHMENT2,
GL_COLOR_ATTACHMENT3
};
glDrawBuffers(4, drawBuffers);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


Shouldn't it clear all four buffers? Or is it not working because I have odd types (RGBA16F and LUMINANCE32F)?

Thanks for your help!

mobeen
02-04-2011, 09:43 PM
Hi,
Recheck your code to see if your framebuffer bound to the draw framebuffer target like this,


glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboID);

Alfonse Reinheart
02-04-2011, 10:01 PM
Shouldn't it clear all four buffers? Or is it not working because I have odd types (RGBA16F and LUMINANCE32F)?

Which buffers does it clear?

Verdagon
02-05-2011, 02:09 AM
Ack, when I posted this, I thought it was only clearing the first one, the RGBA16F one. On a closer look, it looks like its successfully clearing both the RGBA16F ones, and its leaving the LUMINANCE32F's dirty.

It must be a format issue then, because only LUMINANCE32F's are not being cleared. I'm looking on Google though, and nobody mentions anything about this clearing not working for them...

Verdagon
02-05-2011, 02:11 AM
Clarification: GL_LUMINANCE32F_ARB, not GL_LUMINANCE32F

Verdagon
02-05-2011, 02:44 AM
Shoot, nevermind! It turns out it had nothing to do with the format, it was somewhere else completely in my code. Sorry about that! Thanks for your help anyway though!