X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fpipeline.cpp;fp=source%2Fpipeline.cpp;h=fa06fc5c0a985021a20353b1752cb849664e2a59;hp=53b51d7924bc91cfeb6b8c4e84ef6cf24134061a;hb=39488946c441f4007396e438f522609a8b2943ce;hpb=d6f8db673345501a29231890b52cbdfce4a8ecf8 diff --git a/source/pipeline.cpp b/source/pipeline.cpp index 53b51d79..fa06fc5c 100644 --- a/source/pipeline.cpp +++ b/source/pipeline.cpp @@ -38,6 +38,7 @@ void Pipeline::init(unsigned w, unsigned h) width = w; height = h; hdr = false; + alpha = false; samples = 0; target_ms = 0; target[0] = 0; @@ -69,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) @@ -269,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) {