projects
/
opengl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove cmake
[opengl.git]
/
image.cpp
diff --git
a/image.cpp
b/image.cpp
index 02fd60b878ee1122bd9a027e38df10304d681ef8..fb534be70302ef92ca80ab2ba3a8255a10d6326c 100644
(file)
--- a/
image.cpp
+++ b/
image.cpp
@@
-51,17
+51,27
@@
GLenum Image::format() const {
return GL_RGBA;
}
return GL_RGBA;
}
+inline bool Image::usesFloat() const { return info & kCGBitmapFloatComponents; }
+
GLint Image::internalFormat() const {
switch (format()) {
case GL_DEPTH_COMPONENT: return GL_DEPTH_COMPONENT;
GLint Image::internalFormat() const {
switch (format()) {
case GL_DEPTH_COMPONENT: return GL_DEPTH_COMPONENT;
- case GL_RGB: return GL_RGB;
+ 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 {
default: return GL_RGBA;
}
}
GLenum Image::type() const {
- bool isFloat = info & kCGBitmapFloatComponents;
- if (isFloat) return GL_FLOAT;
+ if (usesFloat()) {
+ if (bitsPerComponent == 16) return GL_HALF_FLOAT;
+ else if (bitsPerComponent == 32) return GL_FLOAT;
+ abort();
+ }
return GL_UNSIGNED_BYTE;
//TODO:
return GL_UNSIGNED_BYTE;
//TODO: