}
}
+PixelFormat get_sized_pixelformat(PixelFormat pf)
+{
+ switch(pf)
+ {
+ case RGB: return RGB8;
+ case RGBA: return RGBA8;
+ case SRGB: return SRGB8;
+ case SRGB_ALPHA: return SRGB8_ALPHA8;
+ case LUMINANCE: return LUMINANCE8;
+ case SLUMINANCE: return SLUMINANCE8;
+ case LUMINANCE_ALPHA: return LUMINANCE8_ALPHA8;
+ case SLUMINANCE_ALPHA: return SLUMINANCE8_ALPHA8;
+ case DEPTH_COMPONENT:
+ if(get_gl_api()==OPENGL_ES2)
+ return DEPTH_COMPONENT16;
+ else
+ return DEPTH_COMPONENT32;
+ default: return pf;
+ }
+}
+
PixelFormat get_srgb_pixelformat(PixelFormat pf)
{
switch(pf)
LUMINANCE16F = GL_LUMINANCE16F_ARB,
LUMINANCE32F = GL_LUMINANCE32F_ARB,
LUMINANCE_ALPHA = GL_LUMINANCE_ALPHA,
- LUMINANCE_ALPHA8 = GL_LUMINANCE8_ALPHA8,
+ LUMINANCE8_ALPHA8 = GL_LUMINANCE8_ALPHA8,
LUMINANCE_ALPHA16F = GL_LUMINANCE_ALPHA16F_ARB,
LUMINANCE_ALPHA32F = GL_LUMINANCE_ALPHA32F_ARB,
SLUMINANCE = GL_SLUMINANCE,
SLUMINANCE8 = GL_SLUMINANCE8,
SLUMINANCE_ALPHA = GL_SLUMINANCE_ALPHA,
- SLUMINANCE8_ALPHA8 = GL_SLUMINANCE8_ALPHA8
+ SLUMINANCE8_ALPHA8 = GL_SLUMINANCE8_ALPHA8,
+
+ // Typo, deprecated
+ LUMINANCE_ALPHA8 = GL_LUMINANCE8_ALPHA8
};
void operator>>(const LexicalConverter &, PixelFormat &);
PixelFormat storage_pixelformat_from_graphics(Graphics::PixelFormat, bool = false);
PixelFormat get_base_pixelformat(PixelFormat);
+PixelFormat get_sized_pixelformat(PixelFormat);
PixelFormat get_srgb_pixelformat(PixelFormat);
unsigned get_component_count(PixelFormat);
unsigned get_component_size(PixelFormat);
throw invalid_operation("Texture1D::storage");
if(wd==0)
throw invalid_argument("Texture1D::storage");
+
+ if(MSP_sized_internal_formats)
+ fmt = get_sized_pixelformat(fmt);
require_pixelformat(fmt);
ifmt = fmt;
throw invalid_operation("Texture2D::storage");
if(wd==0 || ht==0)
throw invalid_argument("Texture2D::storage");
+
+ if(MSP_sized_internal_formats)
+ fmt = get_sized_pixelformat(fmt);
require_pixelformat(fmt);
ifmt = fmt;
throw invalid_operation("Texture3D::storage");
if(wd==0 || ht==0 || dp==0)
throw invalid_argument("Texture3D::storage");
+
+ if(MSP_sized_internal_formats)
+ fmt = get_sized_pixelformat(fmt);
require_pixelformat(fmt);
+ ifmt = fmt;
width = wd;
height = ht;
depth = dp;
- ifmt = fmt;
}
void Texture3D::allocate(unsigned level)
throw invalid_operation("TextureCube::storage");
if(sz==0)
throw invalid_argument("TextureCube::storage");
+
+ if(MSP_sized_internal_formats)
+ fmt = get_sized_pixelformat(fmt);
require_pixelformat(fmt);
ifmt = fmt;