]> git.tdb.fi Git - libs/gl.git/blobdiff - source/rendertarget.cpp
Remove commented out debugging statements
[libs/gl.git] / source / rendertarget.cpp
index c651e665fc46064ea2870e7034da0ab93ce081c5..ea8bb0c887d0cfc1f4fb85e721851fe375f10d36 100644 (file)
@@ -46,7 +46,7 @@ RenderTargetFormat RenderTargetFormat::operator,(PixelFormat f) const
        }
        else
        {
-               if(unsized!=RGB && unsized!=RGBA)
+               if(unsized!=RED && unsized!=RG && unsized!=RGB && unsized!=RGBA)
                        throw invalid_argument("RenderTargetformat::operator,");
                if(size>3)
                        --size;
@@ -72,7 +72,6 @@ int RenderTargetFormat::index(RenderOutput o) const
 
 PixelFormat get_output_pixelformat(unsigned char o)
 {
-       unsigned ncomp = (o&3)+1;
        unsigned size = ((o>>2)&3);
        PixelFormat base;
        if(get_output_type(o)>=get_output_type(RENDER_DEPTH))
@@ -83,7 +82,8 @@ PixelFormat get_output_pixelformat(unsigned char o)
        }
        else
        {
-               base = (ncomp==4 ? RGBA : RGB);
+               static PixelFormat base_formats[4] = { RED, RG, RGB, RGBA };
+               base = base_formats[o&3];
                if(size==3)
                        ++size;
        }
@@ -95,6 +95,11 @@ PixelFormat get_output_pixelformat(unsigned char o)
 }
 
 
+RenderTarget::RenderTarget(unsigned w, unsigned h, RenderOutput o)
+{
+       init(w, h, 0, o);
+}
+
 RenderTarget::RenderTarget(unsigned w, unsigned h, const RenderTargetFormat &f)
 {
        init(w, h, 0, f);