X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Ftexture.cpp;fp=source%2Ftexture.cpp;h=cf32ca301cab4bf10bc513ad65de9546c1b757e4;hb=2edfcf08707c3627b6b27289ba607a7183d63b01;hp=f0c55999250263f641e546341e22b7545177748b;hpb=9087cc0a372b9c739f15398c7a22c0a6eb5041bb;p=libs%2Fgl.git diff --git a/source/texture.cpp b/source/texture.cpp index f0c55999..cf32ca30 100644 --- a/source/texture.cpp +++ b/source/texture.cpp @@ -18,7 +18,8 @@ int Texture::swizzle_orders[] = { 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): @@ -60,6 +61,14 @@ void Texture::set_internal_format(PixelFormat fmt) 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:; } @@ -73,7 +82,7 @@ void Texture::set_internal_format(PixelFormat fmt) 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;