summaryrefslogtreecommitdiff
path: root/texturesdl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'texturesdl.cpp')
-rw-r--r--texturesdl.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/texturesdl.cpp b/texturesdl.cpp
index bab760b..94e1e2d 100644
--- a/texturesdl.cpp
+++ b/texturesdl.cpp
@@ -6,18 +6,14 @@
TextureSDL::TextureSDL(const char* filename) {
SDL_Surface* image = IMG_Load(filename);
- width = image->w;
- height = image->h;
-
+ 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;
}
- data = (unsigned char*)image->pixels;
-
- build();
+ build(image->pixels, format, image->w, image->h);
SDL_FreeSurface(image);
}