]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture.cpp
Expand the PixelFormat conversion API
[libs/gl.git] / source / texture.cpp
index 21fc7a6ae9bb41711cf079795e752196c4a2e014..b545b16606eaa64a47c2baac3cedd82df39df029 100644 (file)
@@ -87,8 +87,11 @@ DataType Texture::get_alloc_type(PixelFormat fmt)
 
 void Texture::set_internal_format(PixelFormat fmt)
 {
-       if(MSP_sized_internal_formats)
-               fmt = get_sized_pixelformat(fmt);
+       if(!get_component_size(fmt) && MSP_sized_internal_formats)
+       {
+               unsigned size = (fmt==DEPTH_COMPONENT ? get_gl_api()==OPENGL_ES2 ? 2 : 4 : 1);
+               fmt = get_sized_pixelformat(fmt, size);
+       }
 
        require_pixelformat(fmt);
        ifmt = fmt;