- glTexImage2D(t, 0, GL_SRGB_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+
+ /* 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);