recreate player sprite from scratch and remove all the interpolation noise default tip

Sun, 25 Jan 2026 15:37:23 +0100

author
Mike Becker <universe@uap-core.de>
date
Sun, 25 Jan 2026 15:37:23 +0100
changeset 296
f4f7886f10f0
parent 295
c72df1f06671

recreate player sprite from scratch and remove all the interpolation noise

demo/snake/snake.c file | annotate | diff | comparison | revisions
demo/snake/textures/player-color-map.png file | annotate | diff | comparison | revisions
demo/snake/textures/player.png file | annotate | diff | comparison | revisions
src/ascension/texture.h file | annotate | diff | comparison | revisions
src/text.c file | annotate | diff | comparison | revisions
--- a/demo/snake/snake.c	Sun Jan 25 14:07:50 2026 +0100
+++ b/demo/snake/snake.c	Sun Jan 25 15:37:23 2026 +0100
@@ -126,9 +126,14 @@
 }
 
 static void textures_init(void) {
-    asc_texture_init_2d(tex2d, TEXTURE_2D_COUNT);
+    // don't use interpolation for pixel art
+    asc_texture_init(tex2d, 2, ASC_TEXTURE_2D,
+        ASC_TEXTURE_MIN_FILTER_NEAREST, ASC_TEXTURE_MAG_FILTER_NEAREST);
     asc_texture_from_file(TEXTURE_PLAYER, "player.png");
     asc_texture_from_file(TEXTURE_PLAYER_COLOR_MAP, "player-color-map.png");
+    // interpolate larger, not pixelated, textures
+    asc_texture_init(tex2d+2, 1, ASC_TEXTURE_2D,
+        ASC_TEXTURE_MIN_FILTER_LINEAR, ASC_TEXTURE_MAG_FILTER_LINEAR);
     asc_texture_from_file(TEXTURE_BACKDROP, "backdrop.png");
     asc_gl_context_add_cleanup_func(asc_active_glctx, textures_destroy);
 }
Binary file demo/snake/textures/player-color-map.png has changed
Binary file demo/snake/textures/player.png has changed
--- a/src/ascension/texture.h	Sun Jan 25 14:07:50 2026 +0100
+++ b/src/ascension/texture.h	Sun Jan 25 15:37:23 2026 +0100
@@ -80,14 +80,6 @@
 
 void asc_texture_destroy(AscTexture *tex, unsigned count);
 
-#define asc_texture_init_rectangle(tex, count) \
-    asc_texture_init(tex, count, ASC_TEXTURE_RECTANGLE, \
-        ASC_TEXTURE_MIN_FILTER_NEAREST, ASC_TEXTURE_MAG_FILTER_NEAREST)
-
-#define asc_texture_init_2d(tex, count) \
-    asc_texture_init(tex, count, ASC_TEXTURE_2D, \
-        ASC_TEXTURE_MIN_FILTER_LINEAR, ASC_TEXTURE_MAG_FILTER_LINEAR)
-
 void asc_texture_bind(const AscTexture *tex, int uniform_location, int unit);
 
 void asc_texture_from_surface(AscTexture *tex, const SDL_Surface *surface);
--- a/src/text.c	Sun Jan 25 14:07:50 2026 +0100
+++ b/src/text.c	Sun Jan 25 15:37:23 2026 +0100
@@ -167,7 +167,8 @@
     // initialize texture
     // mesh will be created in the update func
     text->texture = cxMallocDefault(sizeof(AscTexture));
-    asc_texture_init_rectangle(text->texture, 1);
+    asc_texture_init(text->texture, 1, ASC_TEXTURE_RECTANGLE,
+        ASC_TEXTURE_MIN_FILTER_NEAREST, ASC_TEXTURE_MAG_FILTER_NEAREST);
 
     // basic node properties
     asc_scene_node_init(node,

mercurial