X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fpixelformat.cpp;h=0b13f3ccefa7fe53cf2e5868b157a7d0c0e5588b;hp=e915e92fa61160908f8639828ffac60c89b893a7;hb=20af6dd2f04caa224d8cae00befc97d010a1ed08;hpb=e19309340e90ee881e9cb2f8b7c33a5b89681aa6 diff --git a/source/pixelformat.cpp b/source/pixelformat.cpp index e915e92f..0b13f3cc 100644 --- a/source/pixelformat.cpp +++ b/source/pixelformat.cpp @@ -124,14 +124,7 @@ PixelFormat get_sized_pixelformat(PixelFormat pf, unsigned size) if(!size || size>4) throw invalid_argument("get_sized_pixelformat"); - switch(pf) - { - case SRGB: - case SRGB_ALPHA: break; - case SRGB8: pf = SRGB; break; - case SRGB8_ALPHA8: pf = SRGB_ALPHA; break; - default: pf = get_base_pixelformat(pf); - } + pf = get_unsized_pixelformat(pf); switch(size) { @@ -180,6 +173,20 @@ PixelFormat get_sized_pixelformat(PixelFormat pf, unsigned size) } } +PixelFormat get_default_sized_pixelformat(PixelFormat pf) +{ + pf = get_unsized_pixelformat(pf); + unsigned size = 1; + if(pf==DEPTH_COMPONENT) + { + if(get_gl_api()==OPENGL_ES2 && !ARB_depth_buffer_float) + size = 2; + else + size = 4; + } + return get_sized_pixelformat(pf, size); +} + PixelFormat get_srgb_pixelformat(PixelFormat pf) { switch(pf)