]> git.tdb.fi Git - libs/gl.git/blobdiff - source/colorcurve.cpp
Better lifecycle management of the fullscreen quad in PostProcessor
[libs/gl.git] / source / colorcurve.cpp
index f11b83ae2df83258ddf3b77a27e7a2680b847388..0b62583fc4e810e9ea8a772a99dde7fb74db6e4c 100644 (file)
@@ -18,9 +18,10 @@ ColorCurve::ColorCurve():
        shdata.uniform("source", 0);
        shdata.uniform("curve", 1);
 
-       curve.storage(LUMINANCE, 256, 1);
-       curve.set_min_filter(LINEAR);
-       curve.set_wrap(CLAMP_TO_EDGE);
+       curve.storage(LUMINANCE8, 256, 1);
+       Sampler &sampler = curve.get_default_sampler();
+       sampler.set_min_filter(LINEAR);
+       sampler.set_wrap(CLAMP_TO_EDGE);
        texturing.attach(1, curve);
 
        set_exposure_adjust(0.0f);
@@ -49,7 +50,7 @@ void ColorCurve::set_gamma(float g)
        unsigned char curve_data[256];
        for(unsigned i=0; i<256; ++i)
                curve_data[i] = pow(i/255.0f, 1/g)*255+0.5f;
-       curve.image(0, LUMINANCE, UNSIGNED_BYTE, curve_data);
+       curve.image(0, curve_data);
 }
 
 void ColorCurve::set_srgb()
@@ -58,7 +59,7 @@ void ColorCurve::set_srgb()
        curve_data[0] = 0;
        for(unsigned i=1; i<256; ++i)
                curve_data[i] = to_srgb(i/255.0f)*255+0.5f;
-       curve.image(0, LUMINANCE, UNSIGNED_BYTE, curve_data);
+       curve.image(0, curve_data);
 }
 
 void ColorCurve::set_linear()
@@ -66,7 +67,7 @@ void ColorCurve::set_linear()
        unsigned char curve_data[256];
        for(unsigned i=0; i<256; ++i)
                curve_data[i] = i;
-       curve.image(0, LUMINANCE, UNSIGNED_BYTE, curve_data);
+       curve.image(0, curve_data);
 }
 
 void ColorCurve::render(Renderer &renderer, const Texture2D &color_buf, const Texture2D &)
@@ -76,7 +77,7 @@ void ColorCurve::render(Renderer &renderer, const Texture2D &color_buf, const Te
        Renderer::Push push(renderer);
        renderer.set_shader_program(&shprog, &shdata);
        renderer.set_texturing(&texturing);
-       quad.draw(renderer);
+       quad->draw(renderer);
 }