How do you clear OpenGL buffers?


#1

I’m getting this effect where all vertexes ever created are redrawn every frame.

I got a tip that it has something to do with needing to clear the buffer:
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glClearBuffer.xhtml

But I can’t figure out how that relates to my project.

It should be looking more like this:

Interestingly enough, if I resize the frame (manually with my mouse), it clears the buffer… now how to do that automatically…


#2

Use OpenGLHelpers::clear() at the start of every frame.


#3

Thanks. Actually it was an issue with sending all vertexes every frame to be drawn rather than a problem with not clearing the frame.

Might as well ask: how do you apply a low alpha black to get a “pixel decay” effect?