]> git.tdb.fi Git - libs/gl.git/blobdiff - source/pixelformat.cpp
Prefer sized internal formats when possible
[libs/gl.git] / source / pixelformat.cpp
index 99f15307d1304bf41c36c80aa7af825fd41a7171..3fdf6942c63cc606c04babdf54316330878ec1f9 100644 (file)
@@ -103,6 +103,27 @@ PixelFormat get_base_pixelformat(PixelFormat pf)
        }
 }
 
+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)