--- a/src/texture.c Tue Aug 05 16:53:25 2025 +0200 +++ b/src/texture.c Tue Aug 05 20:00:24 2025 +0200 @@ -32,7 +32,7 @@ #include <assert.h> #include <GL/glew.h> -#include <SDL2/SDL_image.h> +#include <SDL3_image/SDL_image.h> void asc_texture_bind(const AscTexture *tex, int uniform_location, int unit) { glActiveTexture(GL_TEXTURE0 + unit); @@ -56,13 +56,13 @@ tex->height = surface->h; glBindTexture(tex->target,tex->tex_id); glPixelStorei(GL_UNPACK_ROW_LENGTH, - surface->pitch / surface->format->BytesPerPixel); + surface->pitch / SDL_BYTESPERPIXEL(surface->format)); if (asc_error_catch_gl("Binding texture object")) return; // Determine the format and internal format based on the SDL surface format GLint internal_format; GLenum format; - switch (surface->format->format) { + switch (surface->format) { case SDL_PIXELFORMAT_RGB24: internal_format = GL_RGB8; format = GL_RGB; @@ -82,7 +82,7 @@ format = GL_BGRA; break; default: - asc_error("Unsupported pixel format: %x", surface->format->format); + asc_error("Unsupported pixel format: %x", surface->format); return; } glTexImage2D(tex->target, 0, internal_format, @@ -102,12 +102,12 @@ SDL_Surface *image = IMG_Load(filepath.ptr); cx_strfree(&filepath); if (image == NULL) { - asc_error("Failed to load texture: %s", IMG_GetError()); + asc_error("Failed to load texture: %s", SDL_GetError()); return; } asc_texture_from_surface(tex, image); asc_dprintf("Free temporary surface %"PRIxPTR, (uintptr_t) image); - SDL_FreeSurface(image); + SDL_DestroySurface(image); } void asc_texture_init(