View Full Version : How does the Current shader affect glClear ?
02-02-2011, 02:18 AM
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.
02-02-2011, 04:44 AM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.