]> git.tdb.fi Git - libs/gl.git/blobdiff - source/bloom.cpp
Entirely new system for building standard shaders
[libs/gl.git] / source / bloom.cpp
index 896147c2e885074620866da9e9e8dacb836ad1a6..b73ea16079622cf34013ff88739be77c94b4852b 100644 (file)
@@ -43,11 +43,11 @@ Bloom::Bloom(unsigned w, unsigned h):
        quad(get_fullscreen_quad())
 {
        blur_shader.attach_shader(get_fullscreen_vertex_shader());
-       blur_shader.attach_shader_owned(new Shader(FRAGMENT_SHADER, blur_fs));
+       blur_shader.attach_shader_owned(new FragmentShader(blur_fs));
        blur_shader.link();
 
        combine_shader.attach_shader(get_fullscreen_vertex_shader());
-       combine_shader.attach_shader_owned(new Shader(FRAGMENT_SHADER, combine_fs));
+       combine_shader.attach_shader_owned(new FragmentShader(combine_fs));
        combine_shader.link();
 
        blur_shdata[0].uniform("delta", 1.0f/w, 0.0f);
@@ -82,9 +82,10 @@ void Bloom::set_radius(float r)
        r = 2*r*r;
        for(int i=-size; i<=size; ++i)
                sum += (factors[size+i] = exp(-i*i/r));
-
        for(int i=0; i<=size*2; ++i)
-               blur_shdata_common.uniform(format("factors[%d]", i), factors[i]/sum);
+               factors[i] /= sum;
+
+       blur_shdata_common.uniform1_array("factors[0]", size*2+1, &factors.front());
 }
 
 void Bloom::set_strength(float s)