How does the Current shader affect glClear?

How would the currently bind shaders affect following code ?
Should i use glUseProgram(0) before making following calls ?

glClearColor (0.f, 0.f ,0.f, 0.f);

The current shader does not affect glClear.


If you want the effect of a clear - but with a shader - you need to draw a screen-sized quad, with Z-testing (and possibly a bunch of other stuff) disabled.

Clear is special because it needs to be super-fast. Most GPU’s have special hardware for doing fast screen-clears. Some systems may not even literally clear the screen but just mark it cleared so that subsequent operations read “cleared data” from the buffer for pixels that haven’t been written to since the last clear. Burdening it with the requirement to run shaders would be incredibly inefficient…and unnecessary since you can always draw a screen-sized quad if that’s what you want.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.