I'm trying to clear color attachments of a framebuffer separately, but glClearBufferfv() throws an error when it shouldn't:
float black[] = { 0, 0, 0, 1 };
float white[] = { 1, 1, 1, 1 };
glClearBufferfv(GL_COLOR, GL_DRAW_BUFFER0, black); // error
glClearBufferfv(GL_COLOR, GL_DRAW_BUFFER1, white); // error
glClearBufferfv(GL_DEPTH, 0, white); // ok
Card is R7 360, latest driver.
CodeXL call stack:
glBindFramebuffer(GL_FRAMEBUFFER, 3)
glDrawBuffers(2, {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1})
glViewport(0, 0, 1360, 768)
glClearBufferfv(GL_COLOR, 34853, 0x0028F528)
CodeXL - OpenGL Error: glClearBufferfv - GL_INVALID_VALUE
Solved! Go to Solution.
Hi asylum29,
the documentation of glClearBufferfv states that if buffer is GL_COLOR you should specify a particular draw buffer GL_DRAW_BUFFERi by passing (just) i as parameter for drawBuffer. So changing your code to
glClearBufferfv(GL_COLOR, 0, black);
glClearBufferfv(GL_COLOR, 1, white);
should work as expected.
I hope this helps.
Can you provide a simple application which reproduces the error? Thanks.
main.cpp line 376: this is the workaround
main.cpp line 387: this is what I want instead
By default the workaround is on, so you have to comment it out and uncomment the other.
(ps.: I will keep this zip in dropbox just for a few days [perhaps a week])
Thanks, I've download the archive and patched the report through to the GL stack team.
Hi asylum29,
the documentation of glClearBufferfv states that if buffer is GL_COLOR you should specify a particular draw buffer GL_DRAW_BUFFERi by passing (just) i as parameter for drawBuffer. So changing your code to
glClearBufferfv(GL_COLOR, 0, black);
glClearBufferfv(GL_COLOR, 1, white);
should work as expected.
I hope this helps.
correct; I recently discovered it and fixed my code accordingly.
Thanks tho for your effort