How does glClear() improve performance?
Posted
by Jon-Eric
on Stack Overflow
See other posts from Stack Overflow
or by Jon-Eric
Published on 2010-03-29T14:29:54Z
Indexed on
2010/03/29
14:33 UTC
Read the original article
Hit count: 440
Apple's Technical Q&A on addressing flickering (QA1650) includes the following paragraph. (Emphasis mine.)
You must provide a color to every pixel on the screen. At the beginning of your drawing code, it is a good idea to use glClear() to initialize the color buffer. A full-screen clear of each of your color, depth, and stencil buffers (if you're using them) at the start of a frame can also generally improve your application's performance.
On other platforms, I've always found it to be an optimization to not clear the color buffer if you're going to draw to every pixel. (Why waste time filling the color buffer if you're just going to overwrite that clear color?)
How can a call to glClear() improve performance?
© Stack Overflow or respective owner