From 5e7f311dc7b37013e52b96a227e49b9d4028d389 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Thu, 11 Sep 2025 02:43:13 +0100 Subject: [PATCH] in ffi, enable GL_DEPTH_TEST and also clear the GL_DEPTH_BUFFER_BIT on each frame; I forgot this before, but it is essential for proper depth testing/layering --- fcore/text-builder.sml | 10 +++++----- ffi/gles3-export.c | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/fcore/text-builder.sml b/fcore/text-builder.sml index 0686475..db5ef92 100644 --- a/fcore/text-builder.sml +++ b/fcore/text-builder.sml @@ -65,13 +65,13 @@ struct Rect.lerp ( Real32.fromInt (posX - 1) , Real32.fromInt posY - , 0.01 + , 0.9 , scale , fw , fh - , r - , g - , b + , 1.0 + , 1.0 + , 1.0 ) fun makeChr (chr, posX, posY, windowWidth, windowHeight, r, g, b) = @@ -79,7 +79,7 @@ struct ( chr , Real32.fromInt posX , Real32.fromInt posY - , 0.05 + , 0.1 , scale , windowWidth , windowHeight diff --git a/ffi/gles3-export.c b/ffi/gles3-export.c index 79e7a11..4515f05 100644 --- a/ffi/gles3-export.c +++ b/ffi/gles3-export.c @@ -13,6 +13,7 @@ unsigned int DYNAMIC_DRAW = GL_DYNAMIC_DRAW; // OpenGL functions used below void loadGlad() { gladLoadGLLoader((GLADloadproc)glfwGetProcAddress); + glEnable(GL_DEPTH_TEST); } void viewport(int width, int height) { @@ -24,7 +25,7 @@ void clearColor(float r, float g, float b, float a) { } void clear() { - glClear(GL_COLOR_BUFFER_BIT); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } unsigned int createBuffer() {