From 0415e4e6b94e7067e8482ca96efe8d960ca79aa2 Mon Sep 17 00:00:00 2001 From: Chad Cuddigan Date: Fri, 11 Sep 2020 16:14:58 -0700 Subject: [PATCH] Making it easier to pick meshes in the editor (#64) --- .../interrupt/dungeoneer/editor/EditorApplication.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/DelvEdit/src/com/interrupt/dungeoneer/editor/EditorApplication.java b/DelvEdit/src/com/interrupt/dungeoneer/editor/EditorApplication.java index dda1338f..b4947982 100644 --- a/DelvEdit/src/com/interrupt/dungeoneer/editor/EditorApplication.java +++ b/DelvEdit/src/com/interrupt/dungeoneer/editor/EditorApplication.java @@ -1560,14 +1560,20 @@ private void RenderEntitiesForPicking() { renderer.Tesselate(level); renderer.renderWorld(level); - Gdx.gl.glDisable(GL20.GL_POLYGON_OFFSET_FILL); + // Pull the vertices a bit closer to the camera this time around, to stop z-fighting with the depth of + // previously drawn objects. Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + Gdx.gl.glEnable(GL20.GL_POLYGON_OFFSET_FILL); + Gdx.gl.glPolygonOffset(-0.15f, 1); // LEQUAL Gdx.gl20.glDisable(GL20.GL_CULL_FACE); renderer.renderEntitiesForPicking(level); pickerFrameBuffer.end(); + + // Put things back to normal + Gdx.gl.glDisable(GL20.GL_POLYGON_OFFSET_FILL); } private void refreshTriangleSpatialHash() {