Fix glClear not working properly if the last rendered model disabled depth or color writing (fix issue #639 on google code)
This commit is contained in:
parent
5d0ac012c9
commit
661053689d
@ -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) {
|
||||||
|
@ -121,9 +121,22 @@ public class IGLESShaderRenderer implements Renderer {
|
|||||||
logger.log(Level.FINE, "IGLESShaderRenderer clearBuffers");
|
logger.log(Level.FINE, "IGLESShaderRenderer clearBuffers");
|
||||||
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) {
|
||||||
|
JmeIosGLES.glColorMask(true, true, true, true);
|
||||||
|
context.colorWriteEnabled = true;
|
||||||
|
}
|
||||||
bits = JmeIosGLES.GL_COLOR_BUFFER_BIT;
|
bits = JmeIosGLES.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) {
|
||||||
|
JmeIosGLES.glDepthMask(true);
|
||||||
|
context.depthWriteEnabled = true;
|
||||||
|
}
|
||||||
bits |= JmeIosGLES.GL_DEPTH_BUFFER_BIT;
|
bits |= JmeIosGLES.GL_DEPTH_BUFFER_BIT;
|
||||||
}
|
}
|
||||||
if (stencil) {
|
if (stencil) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user