问题
I'am new to OpenGL ES and I try to draw triangle,but I can't understand what is a purpose of calling glClear(GL10.GL_COLOR_BUFFER_BIT) on every frame?Without it some strange artifacts occur on screen.Should I call this every time at every frame beginning? Thanks
回答1:
Simplified: If you draw a triangle, only the part of the framebuffer that actually contains the triangle is being redrawn. So if you draw it once, then shift it a little bit and draw it again in the next frame, without a call to glClear, the contents of the previous frame will still be present in the framebuffer.
That's the cause of your artifacts and the reason why you should glClear
your framebuffer every time you suspect something has changed in the image displayed. For most applications, this would indeed mean: Every frame.
来源:https://stackoverflow.com/questions/15506110/opengl-espurpose-of-calling-glclear-on-every-frame