]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/frameformat.cpp
Query the attachments of the default framebuffer
[libs/gl.git] / source / core / frameformat.cpp
index 30d7a47f36500d43172e8fece217e4ebb608c1ed..3b114e7f2f0ebd01da02ea39ce5edd72f64e2be8 100644 (file)
@@ -36,8 +36,8 @@ FrameFormat FrameFormat::operator,(PixelFormat pf) const
                throw invalid_operation("FrameFormat::operator,");
 
        FrameFormat r = *this;
-       UInt16 &fa = r.attachments[r.count-1];
-       fa = make_typed_attachment(static_cast<FrameAttachment>(fa), pf);
+       FrameAttachment &fa = r.attachments[r.count-1];
+       fa = make_typed_attachment(fa, pf);
 
        return r;
 }
@@ -48,8 +48,8 @@ FrameFormat FrameFormat::operator,(unsigned index) const
                throw invalid_operation("FrameFormat::operator,");
 
        FrameFormat r = *this;
-       UInt16 &fa = r.attachments[r.count-1];
-       fa = make_indexed_attachment(static_cast<FrameAttachment>(fa), index);
+       FrameAttachment &fa = r.attachments[r.count-1];
+       fa = make_indexed_attachment(fa, index);
 
        return r;
 }
@@ -89,7 +89,7 @@ FrameAttachment make_typed_attachment(FrameAttachment fa, PixelFormat pf)
        }
 
        DataType type = get_component_type(pf);
-       return static_cast<FrameAttachment>((fa&0xFC00) | (is_float(type)*0x80) | get_type_size(type)<<4 | get_component_count(comp));
+       return static_cast<FrameAttachment>((fa&0xFC00) | (is_float(type)*0x100) | get_type_size(type)<<4 | get_component_count(comp));
 }
 
 FrameAttachment make_indexed_attachment(FrameAttachment fa, unsigned i)
@@ -104,7 +104,7 @@ FrameAttachment make_indexed_attachment(FrameAttachment fa, unsigned i)
                throw invalid_argument("make_indexed_attachment");
 }
 
-PixelFormat get_attachment_pixelformat(UInt16 fa)
+PixelFormat get_attachment_pixelformat(FrameAttachment fa)
 {
        PixelComponents comp;
        if(get_attach_point(fa)==get_attach_point(DEPTH_ATTACHMENT))
@@ -115,7 +115,7 @@ PixelFormat get_attachment_pixelformat(UInt16 fa)
                comp = static_cast<PixelComponents>(fa&7);
 
        DataType type;
-       if(fa&0x80)
+       if(fa&0x100)
                type = static_cast<DataType>((fa&0x70)>>4 | 0x300);
        else
                type = static_cast<DataType>((fa&0x70)>>4);