Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ void TextureResource::load(bool reload) {

if(surface==0) throw TextureException(filename);

// Convert indexed images to RGBA for OpenGL compatibility
if(surface->format->BytesPerPixel == 1) {
SDL_Surface* converted = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_RGBA32, 0);
SDL_FreeSurface(surface);
surface = converted;
if(surface == 0) {
throw TextureException(filename);
}
}

w = surface->w;
h = surface->h;

Expand Down