+ 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;
+
+ /* target */
+ unsigned int t = is_cubemap() ? faces[i] : GL_TEXTURE_2D;
+
+ /* internal format */
+ unsigned int ifmt = images[i].is_float ? GL_RGBA16F : GL_SRGB_ALPHA;
+
+ /* data type of pixel data */
+ unsigned int type = images[i].is_float ? GL_FLOAT : GL_UNSIGNED_BYTE;
+
+ glTexImage2D(t, 0, ifmt, w, h, 0, GL_RGBA, type, images[i].pixels);