#include #include #include #include "texturesdl.h" TextureSDL::TextureSDL(const char* filename) { SDL_Surface* image = IMG_Load(filename); unsigned int format; if(image->format->BytesPerPixel == 4) { format = image->format->Bshift ? GL_RGBA : GL_BGRA; } else { format = image->format->Bshift ? GL_RGB : GL_BGR; } build(image->pixels, format, image->w, image->h); SDL_FreeSurface(image); }