From 8e0a72184085aa6e3e741ad5d79f5db2e63d63a6 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 2 Oct 2010 03:43:27 +0200 Subject: Replaced TextureSDL with TextureSTBI. --- texturestbi.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 texturestbi.cpp (limited to 'texturestbi.cpp') diff --git a/texturestbi.cpp b/texturestbi.cpp new file mode 100644 index 0000000..abd802e --- /dev/null +++ b/texturestbi.cpp @@ -0,0 +1,20 @@ +#include +#include +#include "texturestbi.h" +#include "stb_image.h" + +TextureSTBI::TextureSTBI(const char* filename) { + int w, h, ch; + uint8_t* data = stbi_load(filename, &w, &h, &ch, 4); + + unsigned int format; + if(ch == 4) { + format = GL_RGBA; + } else { + format = GL_RGB; + } + + build(data, format, w, h); + + stbi_image_free(data); +} -- cgit v1.2.3