X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpipeline.cpp;h=fa06fc5c0a985021a20353b1752cb849664e2a59;hb=afb95d09c066b45b7a66b644c04e2d0b2cee2723;hp=27cc3e3c63cc9d274e3573c7da915b21b846899d;hpb=53953f28255e782ed640a9e8d2d42c9b218943ad;p=libs%2Fgl.git diff --git a/source/pipeline.cpp b/source/pipeline.cpp index 27cc3e3c..fa06fc5c 100644 --- a/source/pipeline.cpp +++ b/source/pipeline.cpp @@ -27,12 +27,18 @@ Pipeline::Pipeline(const View &view) init(view.get_width(), view.get_height()); } +Pipeline::Pipeline(const Framebuffer &fbo) +{ + init(fbo.get_width(), fbo.get_height()); +} + void Pipeline::init(unsigned w, unsigned h) { camera = 0; width = w; height = h; hdr = false; + alpha = false; samples = 0; target_ms = 0; target[0] = 0; @@ -64,6 +70,24 @@ void Pipeline::set_hdr(bool h) } } +void Pipeline::set_alpha(bool a) +{ + if(a==alpha) + return; + + bool old_alpha = alpha; + alpha = a; + try + { + create_targets(2); + } + catch(...) + { + alpha = old_alpha; + throw; + } +} + void Pipeline::set_multisample(unsigned s) { if(s==samples) @@ -264,7 +288,7 @@ void Pipeline::create_targets(unsigned recreate) target_ms = 0; } - PixelFormat color_pf = (hdr ? RGB16F : RGB); + PixelFormat color_pf = (hdr ? (alpha ? RGBA16F : RGB16F) : (alpha ? RGBA : RGB)); RenderTargetFormat fmt = (RENDER_COLOR,color_pf, RENDER_DEPTH); if(!postproc.empty() || samples) {