blob: abd802ec4198c3bc9dd3c7fd677cc50db82441e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include <stdexcept>
#include <SFML/Window/OpenGL.hpp>
#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);
}
|