X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Feffects%2Fcolorcurve.cpp;h=9e242d1984007c2c5ea8565f3533630f323f8065;hb=55e3f2d494d939280a4ea48676fd17ca2342b457;hp=697c7257fe84059dcc0eeef53244af28d0bc5e52;hpb=9a63244c1342337915c4610401a24c09fa72cc3d;p=libs%2Fgl.git diff --git a/source/effects/colorcurve.cpp b/source/effects/colorcurve.cpp index 697c7257..9e242d19 100644 --- a/source/effects/colorcurve.cpp +++ b/source/effects/colorcurve.cpp @@ -13,16 +13,12 @@ namespace Msp { namespace GL { ColorCurve::ColorCurve(Resources &resources): - shprog(resources.get("_colorcurve.glsl")), + shprog(resources.get("_colorcurve.glsl.shader")), quad(resources.get("_fullscreen_quad.mesh")), linear_sampler(resources.get("_linear_clamp.samp")), nearest_sampler(resources.get("_nearest_clamp.samp")) { - shdata.uniform("source", 0); - shdata.uniform("curve", 1); - curve.storage(LUMINANCE8, 256, 1); - texturing.attach(1, curve, &linear_sampler); set_exposure_adjust(0.0f); set_brightness_response(0.4f); @@ -38,6 +34,7 @@ void ColorCurve::set_brightness_response(float b) { if(b<=0 || b>1) throw invalid_argument("ColorCurve::set_brightness_response"); + // Calculate an offset value to obtain a derivative of 1 at zero intensity. float t = (b<1 ? pow(b, 1/(1-b)) : 0.0f); shdata.uniform("brightness_response", b, t, pow(t, b)); } @@ -72,11 +69,10 @@ void ColorCurve::set_linear() void ColorCurve::render(Renderer &renderer, const Texture2D &color_buf, const Texture2D &) { - texturing.attach(0, color_buf, &nearest_sampler); - Renderer::Push push(renderer); renderer.set_shader_program(&shprog, &shdata); - renderer.set_texturing(&texturing); + renderer.set_texture("source", &color_buf, &nearest_sampler); + renderer.set_texture("curve", &curve, &linear_sampler); quad.draw(renderer); }