X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=effect_chain.cpp;h=385a87b9f458bd4ed417de9737f709475d0a214a;hp=30dc3e499a7c334f4d0a8e867e9ebbf2d97dd901;hb=54d47f65e9abac77229636fbaaefea8caf34a4d4;hpb=7d4b25da4c2f125b9357c6f1846a1e94ab60f5dc diff --git a/effect_chain.cpp b/effect_chain.cpp index 30dc3e4..385a87b 100644 --- a/effect_chain.cpp +++ b/effect_chain.cpp @@ -1699,23 +1699,6 @@ void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height glDepthMask(GL_FALSE); check_error(); - // Generate a VAO. All the phases should have exactly the same vertex attributes, - // so it's safe to reuse this. - float vertices[] = { - 0.0f, 2.0f, - 0.0f, 0.0f, - 2.0f, 0.0f - }; - - GLuint vao; - glGenVertexArrays(1, &vao); - check_error(); - glBindVertexArray(vao); - check_error(); - - GLuint position_vbo = fill_vertex_attribute(phases[0]->glsl_program_num, "position", 2, GL_FLOAT, sizeof(vertices), vertices); - GLuint texcoord_vbo = fill_vertex_attribute(phases[0]->glsl_program_num, "texcoord", 2, GL_FLOAT, sizeof(vertices), vertices); // Same as vertices. - set generated_mipmaps; // We choose the simplest option of having one texture per output, @@ -1757,12 +1740,6 @@ void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height glUseProgram(0); check_error(); - cleanup_vertex_attribute(phases[0]->glsl_program_num, "position", position_vbo); - cleanup_vertex_attribute(phases[0]->glsl_program_num, "texcoord", texcoord_vbo); - - glDeleteVertexArrays(1, &vao); - check_error(); - if (do_phase_timing) { // Get back the timer queries. for (unsigned phase_num = 0; phase_num < phases.size(); ++phase_num) { @@ -1876,9 +1853,28 @@ void EffectChain::execute_phase(Phase *phase, bool last_phase, maprelease_fbo(fbo); } + + glDeleteVertexArrays(1, &vao); + check_error(); } void EffectChain::setup_uniforms(Phase *phase)