From cb830bed723e6ec76ebe795942c341cb7404a58f Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 13 Mar 2025 16:34:39 +0100 Subject: [PATCH] Increased depth size and clip distances to avoid z-fighting issues --- src/config.h | 4 ++-- src/platforms/rcore_android.c | 2 +- src/platforms/rcore_drm.c | 2 +- src/rlgl.h | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/config.h b/src/config.h index f7b015305..ca54fa8cd 100644 --- a/src/config.h +++ b/src/config.h @@ -136,8 +136,8 @@ #define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported -#define RL_CULL_DISTANCE_NEAR 0.01 // Default projection matrix near cull distance -#define RL_CULL_DISTANCE_FAR 1000.0 // Default projection matrix far cull distance +#define RL_CULL_DISTANCE_NEAR 0.001 // Default projection matrix near cull distance +#define RL_CULL_DISTANCE_FAR 10000.0 // Default projection matrix far cull distance // Default shader vertex attribute locations #define RL_DEFAULT_SHADER_ATTRIB_LOCATION_POSITION 0 diff --git a/src/platforms/rcore_android.c b/src/platforms/rcore_android.c index 5445b1029..eac7f3256 100644 --- a/src/platforms/rcore_android.c +++ b/src/platforms/rcore_android.c @@ -859,7 +859,7 @@ static int InitGraphicsDevice(void) EGL_GREEN_SIZE, 8, // GREEN color bit depth (alternative: 6) EGL_BLUE_SIZE, 8, // BLUE color bit depth (alternative: 5) //EGL_TRANSPARENT_TYPE, EGL_NONE, // Request transparent framebuffer (EGL_TRANSPARENT_RGB does not work on RPI) - EGL_DEPTH_SIZE, 16, // Depth buffer size (Required to use Depth testing!) + EGL_DEPTH_SIZE, 24, // Depth buffer size (Required to use Depth testing!) //EGL_STENCIL_SIZE, 8, // Stencil buffer size EGL_SAMPLE_BUFFERS, sampleBuffer, // Activate MSAA EGL_SAMPLES, samples, // 4x Antialiasing if activated (Free on MALI GPUs) diff --git a/src/platforms/rcore_drm.c b/src/platforms/rcore_drm.c index 47ea6e8a9..baa51a8d8 100644 --- a/src/platforms/rcore_drm.c +++ b/src/platforms/rcore_drm.c @@ -910,7 +910,7 @@ int InitPlatform(void) EGL_BLUE_SIZE, 8, // BLUE color bit depth (alternative: 5) EGL_ALPHA_SIZE, 8, // ALPHA bit depth (required for transparent framebuffer) //EGL_TRANSPARENT_TYPE, EGL_NONE, // Request transparent framebuffer (EGL_TRANSPARENT_RGB does not work on RPI) - EGL_DEPTH_SIZE, 16, // Depth buffer size (Required to use Depth testing!) + EGL_DEPTH_SIZE, 24, // Depth buffer size (Required to use Depth testing!) //EGL_STENCIL_SIZE, 8, // Stencil buffer size EGL_SAMPLE_BUFFERS, sampleBuffer, // Activate MSAA EGL_SAMPLES, samples, // 4x Antialiasing if activated (Free on MALI GPUs) diff --git a/src/rlgl.h b/src/rlgl.h index e5394a6fe..f8e7651d1 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -56,8 +56,8 @@ * * #define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack * #define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported -* #define RL_CULL_DISTANCE_NEAR 0.01 // Default projection matrix near cull distance -* #define RL_CULL_DISTANCE_FAR 1000.0 // Default projection matrix far cull distance +* #define RL_CULL_DISTANCE_NEAR 0.001 // Default projection matrix near cull distance +* #define RL_CULL_DISTANCE_FAR 10000.0 // Default projection matrix far cull distance * * When loading a shader, the following vertex attributes and uniform * location names are tried to be set automatically: @@ -234,10 +234,10 @@ // Projection matrix culling #ifndef RL_CULL_DISTANCE_NEAR - #define RL_CULL_DISTANCE_NEAR 0.01 // Default near cull distance + #define RL_CULL_DISTANCE_NEAR 0.001 // Default near cull distance #endif #ifndef RL_CULL_DISTANCE_FAR - #define RL_CULL_DISTANCE_FAR 1000.0 // Default far cull distance + #define RL_CULL_DISTANCE_FAR 10000.0 // Default far cull distance #endif // Texture parameters (equivalent to OpenGL defines)