GLRenderer: don't set depth function twice
This commit is contained in:
parent
5845671409
commit
f80364a8c2
@ -241,12 +241,12 @@ public class RenderContext {
|
|||||||
public IDList attribIndexList = new IDList();
|
public IDList attribIndexList = new IDList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* depth tets function
|
* depth test function
|
||||||
*/
|
*/
|
||||||
public RenderState.TestFunction depthFunc = RenderState.TestFunction.LessOrEqual;
|
public RenderState.TestFunction depthFunc = RenderState.TestFunction.Less;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* alpha tets function
|
* alpha test function
|
||||||
*/
|
*/
|
||||||
public RenderState.TestFunction alphaFunc = RenderState.TestFunction.Greater;
|
public RenderState.TestFunction alphaFunc = RenderState.TestFunction.Greater;
|
||||||
|
|
||||||
|
@ -614,17 +614,16 @@ public class GLRenderer implements Renderer {
|
|||||||
|
|
||||||
if (state.isDepthTest() && !context.depthTestEnabled) {
|
if (state.isDepthTest() && !context.depthTestEnabled) {
|
||||||
gl.glEnable(GL.GL_DEPTH_TEST);
|
gl.glEnable(GL.GL_DEPTH_TEST);
|
||||||
gl.glDepthFunc(convertTestFunction(context.depthFunc));
|
|
||||||
context.depthTestEnabled = true;
|
context.depthTestEnabled = true;
|
||||||
} else if (!state.isDepthTest() && context.depthTestEnabled) {
|
} else if (!state.isDepthTest() && context.depthTestEnabled) {
|
||||||
gl.glDisable(GL.GL_DEPTH_TEST);
|
gl.glDisable(GL.GL_DEPTH_TEST);
|
||||||
context.depthTestEnabled = false;
|
context.depthTestEnabled = false;
|
||||||
}
|
}
|
||||||
if (state.getDepthFunc() != context.depthFunc) {
|
if (state.isDepthTest() && state.getDepthFunc() != context.depthFunc) {
|
||||||
gl.glDepthFunc(convertTestFunction(state.getDepthFunc()));
|
gl.glDepthFunc(convertTestFunction(state.getDepthFunc()));
|
||||||
context.depthFunc = state.getDepthFunc();
|
context.depthFunc = state.getDepthFunc();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.isDepthWrite() && !context.depthWriteEnabled) {
|
if (state.isDepthWrite() && !context.depthWriteEnabled) {
|
||||||
gl.glDepthMask(true);
|
gl.glDepthMask(true);
|
||||||
context.depthWriteEnabled = true;
|
context.depthWriteEnabled = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user