25 #include "glfFormatDB.hh"
26 #include "glfException.hh"
36 switch (internalFormat)
50 case GL_COMPRESSED_ALPHA:
56 case GL_COMPRESSED_INTENSITY:
68 case GL_COMPRESSED_LUMINANCE:
69 case GL_LUMINANCE16F_ARB:
70 case GL_LUMINANCE32F_ARB:
76 case GL_LUMINANCE_ALPHA:
77 case GL_LUMINANCE4_ALPHA4:
78 case GL_LUMINANCE6_ALPHA2:
79 case GL_LUMINANCE8_ALPHA8:
80 case GL_LUMINANCE12_ALPHA4:
81 case GL_LUMINANCE12_ALPHA12:
82 case GL_LUMINANCE16_ALPHA16:
85 case GL_COMPRESSED_LUMINANCE_ALPHA:
86 case GL_LUMINANCE_ALPHA16F_ARB:
87 case GL_LUMINANCE_ALPHA32F_ARB:
88 format = GL_LUMINANCE_ALPHA;
102 case GL_COMPRESSED_RGB:
119 case GL_COMPRESSED_RGBA:
127 format = GL_RGBA_INTEGER;
131 case GL_DEPTH_COMPONENT:
132 case GL_DEPTH_COMPONENT16:
133 case GL_DEPTH_COMPONENT24:
134 case GL_DEPTH_COMPONENT32:
135 format = GL_DEPTH_COMPONENT;
138 case GL_DEPTH24_STENCIL8_EXT:
139 format = GL_DEPTH_STENCIL_EXT;
144 GLF_THROW_EXCEPTION(
"Unknown or invalid internal texture format")
156 GLF_THROW_EXCEPTION(
"Invalid storage type")
160 return GL_UNSIGNED_BYTE;
164 return GL_UNSIGNED_SHORT;
168 return GL_UNSIGNED_INT;
174 GLF_THROW_EXCEPTION(
"Storage type 'double' is not supported by OpenGL")
178 GLF_THROW_EXCEPTION(
"Unknown storage type")
194 return GL_LUMINANCE_ALPHA;
207 GLF_THROW_EXCEPTION(
"Color model " << colorModel <<
" is not supported by OpenGL or unknown")
224 return GL_LUMINANCE32F_ARB;
226 return GL_LUMINANCE_ALPHA32F_ARB;
231 return GL_RGB32F_ARB;
234 return GL_RGBA32F_ARB;
250 return GL_LUMINANCE_ALPHA;
262 GLF_THROW_EXCEPTION(
"Could not find appropriate OpenGL pixel format for "
263 "storage type " << storageType <<
" and color model "
272 if(enumString ==
"GL_RED")
return GL_RED;
273 if(enumString ==
"GL_GREEN")
return GL_GREEN;
274 if(enumString ==
"GL_BLUE")
return GL_BLUE;
276 if(enumString ==
"GL_RGB")
return GL_RGB;
277 if(enumString ==
"GL_RGBA")
return GL_RGBA;
279 if(enumString ==
"GL_LUMINANCE_ALPHA32F_ARB")
return GL_LUMINANCE_ALPHA32F_ARB;
280 if(enumString ==
"GL_RGB32F" || enumString ==
"GL_RGB32F_ARB")
return GL_RGB32F_ARB;
281 if(enumString ==
"GL_RGBA32F" || enumString ==
"GL_RGBA32F_ARB")
return GL_RGBA32F_ARB;
284 if(enumString ==
"GL_CLAMP")
return GL_CLAMP;
285 if(enumString ==
"GL_CLAMP_TO_BORDER")
return GL_CLAMP_TO_BORDER;
286 if(enumString ==
"GL_REPEAT")
return GL_REPEAT;
288 if(enumString ==
"GL_NEAREST")
return GL_NEAREST;
289 if(enumString ==
"GL_LINEAR")
return GL_LINEAR;
290 if(enumString ==
"GL_NEAREST_MIPMAP_NEAREST")
return GL_NEAREST_MIPMAP_NEAREST;
291 if(enumString ==
"GL_LINEAR_MIPMAP_NEAREST")
return GL_LINEAR_MIPMAP_NEAREST;
292 if(enumString ==
"GL_LINEAR_MIPMAP_LINEAR")
return GL_LINEAR_MIPMAP_LINEAR;
294 if(enumString ==
"GL_LESS")
return GL_LESS;
295 if(enumString ==
"GL_LEQUAL")
return GL_LEQUAL;
296 if(enumString ==
"GL_GREATER")
return GL_GREATER;
297 if(enumString ==
"GL_GEQUAL")
return GL_GEQUAL;
300 BIASERR(
"enumString could not be matched!");
301 return GL_INVALID_ENUM;
307 switch (textureFormat)
316 case GL_LUMINANCE_ALPHA:
328 GLF_THROW_EXCEPTION(
"Invalid or unknown format");
EColorModel
These are the most often used color models.
LAB, 3 channels, http://en.wikipedia.org/wiki/Lab_color_space.
(16bit) unsigned integer image storage type
(8bit) signed char image storage type
double image storage type
invalid not set image storage type
(16bit) signed integer image storage type
color values, 3 channels, order: blue,green,red
Disparity images Q: should disp and depth be treated separately, if not what would be a good name to ...
color values, 3 channels, order: red,green,blue
CIELUV color space, 3 channels, http://en.wikipedia.org/wiki/CIELUV_color_space.
RGBA, 4 channels, order: red,green,blue,alpha.
(32bit) signed integer image storage type
(8bit) unsigned char image storage type
GreyA, 2 channels, grey plus Alpha.
Depth images A: separated for now.
BGRA color values, 4 channels, order: blue,green,red,alpha.
(32bit) unsigned integer image storage type