summaryrefslogtreecommitdiff
path: root/engine/texturesdl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engine/texturesdl.cpp')
-rw-r--r--engine/texturesdl.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/engine/texturesdl.cpp b/engine/texturesdl.cpp
index 8e112ef..bab760b 100644
--- a/engine/texturesdl.cpp
+++ b/engine/texturesdl.cpp
@@ -1,6 +1,6 @@
-#include <iostream>
#include <stdexcept>
#include <SDL/SDL_image.h>
+#include <SDL/SDL_opengl.h>
#include "texturesdl.h"
TextureSDL::TextureSDL(const char* filename) {
@@ -8,7 +8,13 @@ TextureSDL::TextureSDL(const char* filename) {
width = image->w;
height = image->h;
- byte_per_pixel = image->format->BytesPerPixel;
+
+ 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();