- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
- glGenerateMipmap(GL_TEXTURE_2D);
-}
+ 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;