From: Mikko Rasa Date: Wed, 12 Nov 2014 00:05:15 +0000 (+0200) Subject: Make postprocessor shaders compatible with modern interface X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=34446c94b58602c0c6e610b889691f0c1645555f;p=libs%2Fgl.git Make postprocessor shaders compatible with modern interface --- diff --git a/source/ambientocclusion.cpp b/source/ambientocclusion.cpp index f42069be..73736312 100644 --- a/source/ambientocclusion.cpp +++ b/source/ambientocclusion.cpp @@ -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(0)); BindRestore unbind_blend(static_cast(0)); + Bind bind_mesh(quad); { BindRestore bind_fbo(fbo); diff --git a/source/bloom.cpp b/source/bloom.cpp index a7157496..286730b9 100644 --- a/source/bloom.cpp +++ b/source/bloom.cpp @@ -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(0)); BindRestore unbind_blend(static_cast(0)); + Bind bind_mesh(quad); { Bind bind_shader(blur_shader); diff --git a/source/colorcurve.cpp b/source/colorcurve.cpp index 6b456dfe..1c76e1eb 100644 --- a/source/colorcurve.cpp +++ b/source/colorcurve.cpp @@ -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(); diff --git a/source/postprocessor.cpp b/source/postprocessor.cpp index 6c9408cb..3c6fbebe 100644 --- a/source/postprocessor.cpp +++ b/source/postprocessor.cpp @@ -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"; }