Reputation:
In my understanding, if I disable GL_BLEND
, then no blending happens at all.
So I don't need do glClear(GL_COLOR_BUFFER_BIT)
.
I am working on GLES20 for Android programming. I have added the line below.
GLES20.glDisable(GLES20.GL_BLEND);
If I don't add glClear(GL_COLOR_BUFFER_BIT)
, all other devices work well except Nexus 4.
On Nexus 4, on one pass (other passes work normally), only partial area is rendered.
If I add glClear(GL_COLOR_BUFFER_BIT)
, then now Nexus 4 works well.
Upvotes: 0
Views: 1089
Reputation: 211228
If GL_BLEND
is disabled, then a fragment of the draw buffer will be overwritten, if it is drawn to.
If you disable blending and you write on every fragment of the draw buffer in every frame, then it is useless to clear the draw buffer, because each fragment will be set during the drawing process.
glClear(GL_COLOR_BUFFER_BIT)
does nothing else than to write to every fragment with a constant color set by glClearColor
.
Note, you have to ensure, that every fragment is written in each frame. For example if GL_DEPTH_TEST
is enabled you'll have to glClear(GL_DEPTH_BUFFER_BIT
anyway.
Upvotes: 1