diff -r 8e6a661c87db -r f70569c49c24 src/sprite.c --- a/src/sprite.c Tue Jun 24 20:21:38 2025 +0200 +++ b/src/sprite.c Wed Jun 25 21:58:44 2025 +0200 @@ -34,12 +34,10 @@ #include "ascension/shader.h" #include "ascension/constants.h" -#include - typedef struct asc_sprite_shader_s { AscShaderProgram program; - GLint tex; + asc_uniform_loc tex; } AscSpriteShader; static AscShaderProgram *asc_sprite_shader_create(int rect) { @@ -58,7 +56,7 @@ asc_shader_free_codes(codes); return (AscShaderProgram*) shader; } - shader->tex = glGetUniformLocation(shader->program.gl_id, "tex"); + shader->tex = asc_shader_get_uniform_loc(&shader->program, "tex"); asc_shader_free_codes(codes); asc_error_catch_all_gl(); @@ -97,9 +95,9 @@ // Activate shader // TODO: scene should know which shader we are going to activate s.t. it can pre-sort nodes const AscSpriteShader *shader = - sprite->texture->target == GL_TEXTURE_RECTANGLE - ? asc_shader_lookup_or_create(ASC_SHADER_SPRITE_RECT, asc_sprite_shader_create, 1) - : asc_shader_lookup_or_create(ASC_SHADER_SPRITE_UV, asc_sprite_shader_create, 0); + asc_texture_is_uv_normalized(sprite->texture) + ? asc_shader_lookup_or_create(ASC_SHADER_SPRITE_UV, asc_sprite_shader_create, 0) + : asc_shader_lookup_or_create(ASC_SHADER_SPRITE_RECT, asc_sprite_shader_create, 1); // TODO: how to remove the following cast? if (asc_shader_invalid((AscShaderProgram*)shader)) return; asc_shader_use(&shader->program, camera);