]> git.tdb.fi Git - libs/gl.git/commitdiff
Make postprocessor shaders compatible with modern interface
authorMikko Rasa <tdb@tdb.fi>
Wed, 12 Nov 2014 00:05:15 +0000 (02:05 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 12 Nov 2014 00:05:15 +0000 (02:05 +0200)
source/ambientocclusion.cpp
source/bloom.cpp
source/colorcurve.cpp
source/postprocessor.cpp

index f42069bebae007ed15105e34536dada4a98eec98..73736312726ac7013e864ff4e26309ea10082980 100644 (file)
@@ -70,10 +70,12 @@ AmbientOcclusion::AmbientOcclusion(unsigned w, unsigned h, float depth_ratio):
 {
        occlude_shader.attach_shader(get_fullscreen_vertex_shader());
        occlude_shader.attach_shader_owned(new FragmentShader(occlude_fs));
+       occlude_shader.bind_attribute(get_component_type(VERTEX2), "vertex");
        occlude_shader.link();
 
        combine_shader.attach_shader(get_fullscreen_vertex_shader());
        combine_shader.attach_shader_owned(new FragmentShader(combine_fs));
+       combine_shader.bind_attribute(get_component_type(VERTEX2), "vertex");
        combine_shader.link();
 
        occlusion.storage(RGB, w, h);
@@ -137,6 +139,7 @@ void AmbientOcclusion::render(const Texture2D &color, const Texture2D &depth)
 
        BindRestore unbind_dtest(static_cast<DepthTest *>(0));
        BindRestore unbind_blend(static_cast<Blend *>(0));
+       Bind bind_mesh(quad);
 
        {
                BindRestore bind_fbo(fbo);
index a715749608d45247cc1660b73de37044f75b4795..286730b9c599a782e05ed04faa9294031f5fbfa4 100644 (file)
@@ -44,10 +44,12 @@ Bloom::Bloom(unsigned w, unsigned h):
 {
        blur_shader.attach_shader(get_fullscreen_vertex_shader());
        blur_shader.attach_shader_owned(new FragmentShader(blur_fs));
+       blur_shader.bind_attribute(get_component_type(VERTEX2), "vertex");
        blur_shader.link();
 
        combine_shader.attach_shader(get_fullscreen_vertex_shader());
        combine_shader.attach_shader_owned(new FragmentShader(combine_fs));
+       combine_shader.bind_attribute(get_component_type(VERTEX2), "vertex");
        combine_shader.link();
 
        blur_shdata[0].uniform("delta", 1.0f/w, 0.0f);
@@ -102,6 +104,7 @@ void Bloom::render(const Texture2D &src, const Texture2D &)
 {
        BindRestore unbind_dtest(static_cast<DepthTest *>(0));
        BindRestore unbind_blend(static_cast<Blend *>(0));
+       Bind bind_mesh(quad);
 
        {
                Bind bind_shader(blur_shader);
index 6b456dfe31bbc55a21d0148459c43a5d800e8f42..1c76e1eb885ddbc284d13d7510d588e25a66e620 100644 (file)
@@ -45,6 +45,7 @@ ColorCurve::ColorCurve():
 {
        shprog.attach_shader(get_fullscreen_vertex_shader());
        shprog.attach_shader_owned(new FragmentShader(fragment_src));
+       shprog.bind_attribute(get_component_type(VERTEX2), "vertex");
        shprog.link();
 
        shdata.uniform("texture", 0);
@@ -105,6 +106,7 @@ void ColorCurve::render(const Texture2D &color_buf, const Texture2D &)
 {
        Bind _bind_shader(shprog);
        shdata.apply();
+       Bind _bind_mesh(quad);
        Bind _bind_tex(color_buf);
        Bind _bind_curve(curve, 1);
        quad.draw();
index 6c9408cb00db48772d361bfa8b5754338ea00c30..3c6fbebe89b5704b64a6fd1428a6259fc76f34bb 100644 (file)
@@ -6,11 +6,12 @@
 namespace {
 
 const char fullscreen_vs_source[] =
+       "attribute vec4 vertex;\n"
        "varying vec2 texcoord;\n"
        "void main()\n"
        "{\n"
-       "       gl_Position = gl_Vertex;\n"
-       "       texcoord = gl_Vertex.xy*0.5+0.5;\n"
+       "       gl_Position = vertex;\n"
+       "       texcoord = vertex.xy*0.5+0.5;\n"
        "}\n";
 
 }