Commit: 8aeba1450218830aadfd7b9d08841e02b957561d
Parent: fd15c30568eb06496bd50c3b379372a792ed227d
Author: Randy Palamar
Date: Mon, 26 May 2025 21:06:40 -0600
set mirrored mode on 3D texture dim, disable linear sampling
It seems like trying to interpolate our data linearly on the same
level (default) or with any of the mipmap combinations produces
ugly artifacts.
Diffstat:
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/common.c b/common.c
@@ -209,6 +209,9 @@ load_complex_texture(Arena arena, c8 *file_path, b32 multi_file, u32 width, u32
glTextureStorage3D(result, 1, GL_RG32F, width, height, depth);
glTextureParameteri(result, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
glTextureParameteri(result, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
+ glTextureParameteri(result, GL_TEXTURE_WRAP_R, GL_MIRRORED_REPEAT);
+ glTextureParameteri(result, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTextureParameteri(result, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if (multi_file) {
/* NOTE(rnp): assumes single plane */
@@ -225,6 +228,7 @@ load_complex_texture(Arena arena, c8 *file_path, b32 multi_file, u32 width, u32
str8 raw = os_read_whole_file(&arena, file_path);
if (raw.len) glTextureSubImage3D(result, 0, 0, 0, 0, width, height, depth, GL_RG, GL_FLOAT, raw.data);
}
+
return result;
}
diff --git a/render_model.frag.glsl b/render_model.frag.glsl
@@ -33,13 +33,14 @@ void main()
smp = 1 - smp;
}
- //out_colour = vec4(abs(normal), 1);
- //out_colour = vec4(1, 1, 1, smp);
- //out_colour = vec4(smp * abs(normal), 1);
-
if (bounding_box_test(test_texture_coordinate, u_bb_fraction)) {
out_colour = u_bb_colour;
} else {
out_colour = vec4(smp, smp, smp, 1);
}
+
+ //out_colour = vec4(textureQueryLod(u_texture, tex_coord).y, 0, 0, 1);
+ //out_colour = vec4(abs(normal), 1);
+ //out_colour = vec4(1, 1, 1, smp);
+ //out_colour = vec4(smp * abs(normal), 1);
}