Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug 1886 - SDL_image 2.0rc: TGA channels mixed up on some platf…
…orms Steffen Hein I'm running into a problem when loading TGA files on different platforms with SDL_image 2.0rc1. It works fine on OSX and iOS (AFAIK SDL_image uses the operating system routines on these platforms), but on Windows and Linux, the channels are mixed up. The textures I used for this bug report can be downloaded here: http://www.dexsoft-games.com/models/medieval_free.html http://www.dexsoft-games.com/freebies/models/medieval_free_mesh.7z Excerpt from my texture loading function: [...] if( is_tga ) { source_image = IMG_LoadTyped_RW(rw, FALSE, "TGA"); } else { source_image = IMG_Load_RW(rw, FALSE); } printf("Flags: %x\n", source_image->flags); printf("Size: %dx%d\n", source_image->w, source_image->h); printf("PF BPP: %d\n", source_image->format->BitsPerPixel); printf("PF Rmask: %08x\n", source_image->format->Rmask); printf("PF Gmask: %08x\n", source_image->format->Gmask); printf("PF Bmask: %08x\n", source_image->format->Bmask); printf("PF Amask: %08x\n", source_image->format->Amask); // Convert into suitable format for OpenGL upload SDL_Surface *format_template = SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 1, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000); SDL_Surface *image = SDL_ConvertSurface(source_image, format_template->format, 0); [...] Result on OSX/iOS: Loading texture: 'models/medieval_free_dex/doorwindow_set.tga' Flags: 0 Size: 512x512 PF BPP: 32 PF Rmask: 00ff0000 PF Gmask: 0000ff00 PF Bmask: 000000ff PF Amask: ff000000 Result on Windows/Linux: Loading texture: 'models/medieval_free_dex/doorwindow_set.tga' Flags: 0 Size: 512x512 PF BPP: 32 PF Rmask: 0000ff00 PF Gmask: 00ff0000 PF Bmask: ff000000 PF Amask: 000000ff Thanks! -Steffen
- Loading branch information