diff --git a/jogl/src/main/kotlin/com/huskerdev/openglfx/jogl/direct/JOGLDirect.kt b/jogl/src/main/kotlin/com/huskerdev/openglfx/jogl/direct/JOGLDirect.kt index 5ae615e..be1854e 100644 --- a/jogl/src/main/kotlin/com/huskerdev/openglfx/jogl/direct/JOGLDirect.kt +++ b/jogl/src/main/kotlin/com/huskerdev/openglfx/jogl/direct/JOGLDirect.kt @@ -68,6 +68,11 @@ class JOGLDirect: JOGLFXCanvas() { if(needTextureRepaint) { needTextureRepaint = false + val texGr = texture.createGraphics() + texGr.isDepthBuffer = true + texGr.isDepthTest = true + texGr.clear() + JOGLUtils.rawGL(gl) { if (gl !is GL2) return@rawGL diff --git a/lwjgl/src/main/kotlin/com/huskerdev/openglfx/lwjgl/direct/LWJGLDirect.kt b/lwjgl/src/main/kotlin/com/huskerdev/openglfx/lwjgl/direct/LWJGLDirect.kt index 474c726..981cea5 100644 --- a/lwjgl/src/main/kotlin/com/huskerdev/openglfx/lwjgl/direct/LWJGLDirect.kt +++ b/lwjgl/src/main/kotlin/com/huskerdev/openglfx/lwjgl/direct/LWJGLDirect.kt @@ -64,6 +64,11 @@ class LWJGLDirect: LWJGLCanvas() { if(needTextureRepaint) { needTextureRepaint = false + val texGr = texture.createGraphics() + texGr.isDepthBuffer = true + texGr.isDepthTest = true + texGr.clear() + LWJGLUtils.rawGL { glBindFramebuffer(GL_FRAMEBUFFER, textureFBO) glViewport(0, 0, scaledWidth.toInt(), scaledHeight.toInt())