Be more careful w/ my depth comparisons
This commit is contained in:
parent
1a6c721add
commit
e8bf775e56
@ -129,13 +129,13 @@ public class RealisticRenderer extends RocketRenderer {
|
||||
gl.glMateriali(GL.GL_BACK, GLLightingFunc.GL_SHININESS, 0);
|
||||
|
||||
if (t != null && tex != null) {
|
||||
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR);
|
||||
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
|
||||
|
||||
if ( t.getEdgeMode() == Decal.EdgeMode.STICKER ){
|
||||
cr.renderGeometry(gl, c);
|
||||
}
|
||||
|
||||
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR);
|
||||
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
|
||||
|
||||
tex.enable(gl);
|
||||
tex.bind(gl);
|
||||
gl.glMatrixMode(GL.GL_TEXTURE);
|
||||
@ -161,6 +161,7 @@ public class RealisticRenderer extends RocketRenderer {
|
||||
|
||||
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl.glEnable(GL.GL_BLEND);
|
||||
gl.glDepthFunc(GL.GL_LEQUAL);
|
||||
}
|
||||
|
||||
gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
|
||||
@ -168,16 +169,21 @@ public class RealisticRenderer extends RocketRenderer {
|
||||
if (anisotrophy > 0) {
|
||||
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotrophy);
|
||||
}
|
||||
}
|
||||
|
||||
cr.renderGeometry(gl, c);
|
||||
|
||||
if (tex != null) {
|
||||
|
||||
cr.renderGeometry(gl, c);
|
||||
|
||||
if ( t.getEdgeMode() == Decal.EdgeMode.STICKER ){
|
||||
gl.glDepthFunc(GL.GL_LESS);
|
||||
}
|
||||
|
||||
gl.glMatrixMode(GL.GL_TEXTURE);
|
||||
gl.glPopMatrix();
|
||||
gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
|
||||
tex.disable(gl);
|
||||
} else {
|
||||
cr.renderGeometry(gl, c);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void clearCaches(GL2 gl) {
|
||||
|
@ -390,7 +390,7 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
|
||||
GL2 gl = drawable.getGL().getGL2();
|
||||
gl.glClearDepth(1.0f); // clear z-buffer to the farthest
|
||||
|
||||
gl.glDepthFunc(GL.GL_LEQUAL); // the type of depth test to do
|
||||
gl.glDepthFunc(GL.GL_LESS); // the type of depth test to do
|
||||
|
||||
float amb = 0.5f;
|
||||
float dif = 1.0f;
|
||||
|
@ -121,7 +121,7 @@ public abstract class RocketRenderer {
|
||||
gl.glDepthRange(1, 1);
|
||||
gl.glDepthFunc(GL.GL_ALWAYS);
|
||||
cr.renderGeometry(gl, c);
|
||||
gl.glDepthFunc(GL.GL_LEQUAL);
|
||||
gl.glDepthFunc(GL.GL_LESS);
|
||||
gl.glDepthRange(0, 1);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user