I remember reading that you should always call glClear at least once a frame or modern graphics cards would drop in performance. I cant quite remember the article, but it had to do with certain optimizations that graphics cards do internally. Gl clear will tell them that a frame was finished and all internal information can be discarded since the next frame will begin shortly. Or something like that.
Thanks. From what I have been gathering on the internet they are functionally the same.
My curiosity stems from the fact that one may be faster than the other; it seems that once you have a particular color you want to clear to set glClear would be faster only because you are not sending four floats all of the time to specify the clear color like you would be doing with glClearBuffer*.
But, of course, I may be wrong.
Was just curious from the experts and experienced users what their real world experience has been.
You clear the framebuffer once each frame, in overall performance the difference is close to immeasurable. I think ultimately both functions use the same hardware functionality. As I see it, glClearBuffer is just a more versatile and user friendly interface than the somewhat clumsy glClear with its separate setter functions.
glClearBuffer allows you to clear the color attachments to different colors, or to only clear certain attachments. glClear clears every color attachment to the color specified by glClearColor.
glClear/glClearBuffer should be both able to return control fairly quickly without stalling OpenGL. For overall performance the 2 calls should be similar if you’re clearing all color attachments. The main thing that will determine how much work needs to be done will be how large an area needs to be cleared.