X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=effect_chain.cpp;fp=effect_chain.cpp;h=7bce60fa21c1e076c3082d69ff2e409cc342750a;hb=5ee3e6bb0bf100d57a06911b89c3a0a0dc49e2be;hp=e4ab7199c8d23320c545d47c98b4c53dec39af3b;hpb=9b0bd744d606d9d92bd955e0e575c73aa505073d;p=movit diff --git a/effect_chain.cpp b/effect_chain.cpp index e4ab719..7bce60f 100644 --- a/effect_chain.cpp +++ b/effect_chain.cpp @@ -1,6 +1,6 @@ #define GL_GLEXT_PROTOTYPES 1 -#include +#include #include #include #include @@ -238,7 +238,7 @@ string replace_prefix(const string &text, const string &prefix) void EffectChain::compile_glsl_program(Phase *phase) { - string frag_shader = read_file("header.frag"); + string frag_shader = read_version_dependent_file("header", "frag"); // Create functions for all the texture inputs that we need. for (unsigned i = 0; i < phase->inputs.size(); ++i) { @@ -249,7 +249,7 @@ void EffectChain::compile_glsl_program(Phase *phase) frag_shader += string("uniform sampler2D tex_") + effect_id + ";\n"; frag_shader += string("vec4 ") + effect_id + "(vec2 tc) {\n"; - frag_shader += "\treturn texture2D(tex_" + string(effect_id) + ", tc);\n"; + frag_shader += "\treturn tex2D(tex_" + string(effect_id) + ", tc);\n"; frag_shader += "}\n"; frag_shader += "\n"; } @@ -288,9 +288,10 @@ void EffectChain::compile_glsl_program(Phase *phase) frag_shader += "\n"; } frag_shader += string("#define INPUT ") + phase->effect_ids[phase->effects.back()] + "\n"; - frag_shader.append(read_file("footer.frag")); + frag_shader.append(read_version_dependent_file("footer", "frag")); - phase->glsl_program_num = resource_pool->compile_glsl_program(read_file("vs.vert"), frag_shader); + string vert_shader = read_version_dependent_file("vs", "vert"); + phase->glsl_program_num = resource_pool->compile_glsl_program(vert_shader, frag_shader); // Prepare the geometry for the fullscreen quad used in this phase. // (We have separate VAOs per shader, since the bindings can in theory