]> git.tdb.fi Git - libs/gl.git/blobdiff - source/effects/colorcurve.cpp
Cosmetic fixes
[libs/gl.git] / source / effects / colorcurve.cpp
index 697c7257fe84059dcc0eeef53244af28d0bc5e52..9e242d1984007c2c5ea8565f3533630f323f8065 100644 (file)
@@ -13,16 +13,12 @@ namespace Msp {
 namespace GL {
 
 ColorCurve::ColorCurve(Resources &resources):
-       shprog(resources.get<Program>("_colorcurve.glsl")),
+       shprog(resources.get<Program>("_colorcurve.glsl.shader")),
        quad(resources.get<Mesh>("_fullscreen_quad.mesh")),
        linear_sampler(resources.get<Sampler>("_linear_clamp.samp")),
        nearest_sampler(resources.get<Sampler>("_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);
 }