cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

asylum29
Adept II

glClearBufferfv throws GL_INVALID_VALUE

Jump to solution

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

0 Likes
1 Solution

Accepted Solutions
mksrksh
Adept II

Re: glClearBufferfv throws GL_INVALID_VALUE

Jump 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.

View solution in original post

5 Replies
dwitczak
Staff
Staff

Re: glClearBufferfv throws GL_INVALID_VALUE

Jump to solution

Can you provide a simple application which reproduces the error? Thanks.

0 Likes
asylum29
Adept II

Re: glClearBufferfv throws GL_INVALID_VALUE

Jump to solution

Dropbox - FOR_AMD.zip


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])

0 Likes
dwitczak
Staff
Staff

Re: glClearBufferfv throws GL_INVALID_VALUE

Jump to solution

Thanks, I've download the archive and patched the report through to the GL stack team.

0 Likes
mksrksh
Adept II

Re: glClearBufferfv throws GL_INVALID_VALUE

Jump 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.

View solution in original post

asylum29
Adept II

Re: glClearBufferfv throws GL_INVALID_VALUE

Jump to solution

correct; I recently discovered it and fixed my code accordingly.

Thanks tho for your effort

0 Likes