+inline bool Image::usesFloat() const { return info & kCGBitmapFloatComponents; }
+
+GLint Image::internalFormat() const {
+ switch (format()) {
+ case GL_DEPTH_COMPONENT: return GL_DEPTH_COMPONENT;
+ case GL_RGB:
+ if (bitsPerComponent == 16)
+ return usesFloat() ? GL_RGB16F : GL_RGB16;
+ else if (bitsPerComponent == 8)
+ return GL_RGB;
+ else abort();
+ default: return GL_RGBA;
+ }
+}
+
+GLenum Image::type() const {
+ if (usesFloat()) {
+ if (bitsPerComponent == 16) return GL_HALF_FLOAT;
+ else if (bitsPerComponent == 32) return GL_FLOAT;
+ abort();
+ }
+ return GL_UNSIGNED_BYTE;
+
+ //TODO:
+ /* switch (bitsPerComponent) { */
+ /* case 1: return GL_UNSIGNED_BYTE; */
+ /* case 16: return GL_UNSIGNED_SHORT; */
+ /* case 24: */
+}
+