+ glBindTexture(target, tex);
+ }
+
+ static const unsigned int faces[] = {
+ GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
+ };
+
+ for(size_t i=0; i<images.size(); i++) {
+ int w = images[i].w;
+ int h = images[i].h;
+
+ unsigned char *pixels = images[i].pixels;
+ unsigned int t = is_cubemap() ? faces[i] : GL_TEXTURE_2D;
+ glTexImage2D(t, 0, GL_SRGB_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);