This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Combined vs individual glClear performance

Hi,

Basically I wanted to know if calling glClear with all buffers bits to clear is faster than clearing them all individually.

So:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

is faster thabn:

glClear(GL_COLOR_BUFFER_BIT);
glClear(GL_DEPTH_BUFFER_BIT);

Cheers!

Parents
  • While the driver may possibly be clever enough to combine them if they're next to each other, I really don't see any advantage to the second option. It'll always be faster to do a command once rather than twice. And the first is very clear from a code reading point of view. You don't want to risk traversing through all that memory more times than you need to.

Reply
  • While the driver may possibly be clever enough to combine them if they're next to each other, I really don't see any advantage to the second option. It'll always be faster to do a command once rather than twice. And the first is very clear from a code reading point of view. You don't want to risk traversing through all that memory more times than you need to.

Children