X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fpipeline.cpp;h=fd638fb6ebbbbdd0a95a78caa57586d67b7660bf;hb=58e3368ddb21de5c4bc6e208440de369fe4876f1;hp=0df03ca7df7231931874355f855de9c3284cd148;hpb=31f4e9f522ba3009cfa74467bec380a263eabf73;p=libs%2Fgl.git diff --git a/source/pipeline.cpp b/source/pipeline.cpp index 0df03ca7..fd638fb6 100644 --- a/source/pipeline.cpp +++ b/source/pipeline.cpp @@ -49,8 +49,17 @@ void Pipeline::set_multisample(unsigned s) if(s==samples) return; + unsigned old_samples = samples; samples = s; - create_targets(1); + try + { + create_targets(1); + } + catch(...) + { + samples = old_samples; + throw; + } } void Pipeline::set_camera(const Camera *c) @@ -138,9 +147,7 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const setup_frame(); const Framebuffer *out_fbo = Framebuffer::current(); - /* Binding the current object is a no-op, but this will restore the original - FBO in case an exception is thrown. */ - Bind restore_fbo(out_fbo, true); + // XXX Make sure the correct FBO is restored if an exception is thrown if(target[0]) { @@ -160,6 +167,8 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const renderer.render(*j->renderable, i->get_tag()); } + renderer.end(); + if(target[0]) { if(samples)