From 5158ecbf7a50a60dbac260d09f417de02a95c2d4 Mon Sep 17 00:00:00 2001 From: Kai Blaschke Date: Tue, 11 Nov 2025 15:39:43 +0100 Subject: [PATCH] Load image file and create texture separately with SOIL2 The new combined function no longer returns the image size, so we need to load the image ourselves, store the size and then pass the buffer to SOIL_create_OGL_texture(). --- src/libprojectM/Renderer/TextureManager.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/libprojectM/Renderer/TextureManager.cpp b/src/libprojectM/Renderer/TextureManager.cpp index 858c7b779..ebed793ba 100644 --- a/src/libprojectM/Renderer/TextureManager.cpp +++ b/src/libprojectM/Renderer/TextureManager.cpp @@ -212,13 +212,23 @@ auto TextureManager::LoadTexture(const ScannedFile& file) -> std::shared_ptr imageData(SOIL_load_image(file.filePath.c_str(), &width, &height, &channels, SOIL_LOAD_RGBA), SOIL_free_image_data); + + if (imageData == nullptr) + { + return {}; + } + + unsigned int const tex = SOIL_create_OGL_texture( + imageData.get(), + &width, &height, SOIL_LOAD_RGBA, SOIL_CREATE_NEW_ID, SOIL_FLAG_MULTIPLY_ALPHA); + imageData.reset(); + if (tex == 0) { return {};