fmt = SRGB8;
else if(conv.get()=="SRGB8_ALPHA8")
fmt = SRGB8_ALPHA8;
+ else if(conv.get()=="BGR8")
+ fmt = BGR8;
+ else if(conv.get()=="BGRA8")
+ fmt = BGRA8;
else if(conv.get()=="LUMINANCE8")
fmt = LUMINANCE8;
else if(conv.get()=="LUMINANCE8_ALPHA8")
PixelFormat make_pixelformat(PixelComponents comp, DataType type, bool srgb)
{
- if(srgb && type!=UNSIGNED_BYTE && comp!=RGB && comp!=RGBA)
+ if(srgb && type!=UNSIGNED_BYTE && comp!=RGB && comp!=RGBA && comp!=BGR && comp!=BGRA)
throw invalid_argument("make_pixelformat");
switch(comp)
case FLOAT: return RGBA32F;
default: throw invalid_argument("make_pixelformat");
}
+ case BGR:
+ if(type!=UNSIGNED_BYTE)
+ throw invalid_argument("make_pixelformat");
+ return (srgb ? BGR8 : SBGR8);
+ case BGRA:
+ if(type!=UNSIGNED_BYTE)
+ throw invalid_argument("make_pixelformat");
+ return (srgb ? BGRA8 : SBGR8_ALPHA8);
case LUMINANCE:
if(type!=UNSIGNED_BYTE)
throw invalid_argument("make_pixelformat");
case RGBA16F:
case RGBA32F:
case SRGB8_ALPHA8: return RGBA;
+ case BGR8:
+ case SBGR8: return BGR;
+ case BGRA8:
+ case SBGR8_ALPHA8: return BGRA;
case LUMINANCE8: return LUMINANCE;
case LUMINANCE8_ALPHA8: return LUMINANCE_ALPHA;
case STENCIL_INDEX8: return STENCIL_INDEX;
case RGBA8:
case SRGB8:
case SRGB8_ALPHA8:
+ case BGR8:
+ case BGRA8:
+ case SBGR8:
+ case SBGR8_ALPHA8:
case LUMINANCE8:
case LUMINANCE8_ALPHA8:
return UNSIGNED_BYTE;
RGBA32F = GL_RGBA32F,
SRGB8 = GL_SRGB8,
SRGB8_ALPHA8 = GL_SRGB8_ALPHA8,
+ BGR8 = 200000,
+ BGRA8 = 200001,
+ SBGR8 = 200002,
+ SBGR8_ALPHA8 = 200003,
LUMINANCE8 = GL_LUMINANCE8,
LUMINANCE8_ALPHA8 = GL_LUMINANCE8_ALPHA8,
DEPTH_COMPONENT16 = GL_DEPTH_COMPONENT16,
{
GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA,
GL_RED, GL_RED, GL_RED, GL_ONE,
- GL_RED, GL_RED, GL_RED, GL_GREEN
+ GL_RED, GL_RED, GL_RED, GL_GREEN,
+ GL_BLUE, GL_GREEN, GL_RED, GL_ALPHA
};
Texture::Texture(GLenum t, ResourceManager *m):
comp = RG;
swiz = RG_TO_LUMINANCE_ALPHA;
break;
+ case BGR:
+ comp = RGB;
+ swiz = RGB_TO_BGR;
+ break;
+ case BGRA:
+ comp = RGBA;
+ swiz = RGB_TO_BGR;
+ break;
default:;
}
PixelComponents Texture::get_upload_components(PixelComponents comp) const
{
- if(comp==LUMINANCE || comp==LUMINANCE_ALPHA)
+ if(comp==LUMINANCE || comp==LUMINANCE_ALPHA || comp==BGR || comp==BGRA)
return get_components(ifmt);
else
return comp;