|
|
@ -392,9 +392,22 @@ public class OGLESShaderRenderer implements Renderer { |
|
|
|
public void clearBuffers(boolean color, boolean depth, boolean stencil) { |
|
|
|
public void clearBuffers(boolean color, boolean depth, boolean stencil) { |
|
|
|
int bits = 0; |
|
|
|
int bits = 0; |
|
|
|
if (color) { |
|
|
|
if (color) { |
|
|
|
|
|
|
|
//See explanations of the depth below, we must enable color write to be able to clear the color buffer
|
|
|
|
|
|
|
|
if (context.colorWriteEnabled == false) { |
|
|
|
|
|
|
|
GLES20.glColorMask(true, true, true, true); |
|
|
|
|
|
|
|
context.colorWriteEnabled = true; |
|
|
|
|
|
|
|
} |
|
|
|
bits = GLES20.GL_COLOR_BUFFER_BIT; |
|
|
|
bits = GLES20.GL_COLOR_BUFFER_BIT; |
|
|
|
} |
|
|
|
} |
|
|
|
if (depth) { |
|
|
|
if (depth) { |
|
|
|
|
|
|
|
//glClear(GL_DEPTH_BUFFER_BIT) seems to not work when glDepthMask is false
|
|
|
|
|
|
|
|
//here s some link on openl board
|
|
|
|
|
|
|
|
//http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=257223
|
|
|
|
|
|
|
|
//if depth clear is requested, we enable the depthMask
|
|
|
|
|
|
|
|
if (context.depthWriteEnabled == false) { |
|
|
|
|
|
|
|
GLES20.glDepthMask(true); |
|
|
|
|
|
|
|
context.depthWriteEnabled = true; |
|
|
|
|
|
|
|
} |
|
|
|
bits |= GLES20.GL_DEPTH_BUFFER_BIT; |
|
|
|
bits |= GLES20.GL_DEPTH_BUFFER_BIT; |
|
|
|
} |
|
|
|
} |
|
|
|
if (stencil) { |
|
|
|
if (stencil) { |
|
|
|