20 Cubemap(
const tenno::vector<std::filesystem::path>& faces)
21 :
Texture(Cubemap::default_config)
23 glGenTextures(1, &this->
id);
24 glBindTexture(GL_TEXTURE_CUBE_MAP, this->
id);
26 stbi_set_flip_vertically_on_load(Cubemap::default_config.properties.flipped);
27 int width, height, nrChannels;
28 for (
unsigned int i = 0; i < faces.size(); ++i)
30 unsigned char *data = stbi_load(faces[i].
string().c_str(),
37 ERROR(
"Error loading cubemap face {}", faces[i].
string());
38 stbi_image_free(data);
42 glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i,
43 0, GL_RGB, width, height, 0, GL_RGB,
44 GL_UNSIGNED_BYTE, data);
45 stbi_image_free(data);
47 this->memory += 3 * width * height;
48 Texture::memory += this->memory;