Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does glColorMask affect glClear

What should the following code do assuming something was drawn before the code below?

glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);

Should this code just set the alpha to 1 or will it clear the color buffer?

Or in other words, does glColorMask affect what glClear does or does it only apply to normal draw operations?

I am asking specifically with regards to OpenGL ES 2.0 so any reference to a spec will be appreciated.

like image 573
doron Avatar asked Sep 18 '12 10:09

doron


1 Answers

It will clear the alpha channel only.

The pixel ownership test, the scissor test, dithering, and the buffer writemasks affect the operation of glClear

like image 61
Plow Avatar answered Oct 27 '22 19:10

Plow