- // Find a texture for this phase.
- inform_input_sizes(phase);
- if (phase_num != phases.size() - 1) {
- find_output_size(phase);
-
- GLuint tex_num = resource_pool->create_2d_texture(GL_RGBA16F, phase->output_width, phase->output_height);
- output_textures.insert(make_pair(phase, tex_num));
- }
-
- const GLuint glsl_program_num = phase->glsl_program_num;
- check_error();
- glUseProgram(glsl_program_num);
- check_error();
-
- // Set up RTT inputs for this phase.
- for (unsigned sampler = 0; sampler < phase->inputs.size(); ++sampler) {
- glActiveTexture(GL_TEXTURE0 + sampler);
- Phase *input = phase->inputs[sampler];
- input->output_node->bound_sampler_num = sampler;
- glBindTexture(GL_TEXTURE_2D, output_textures[input]);
- check_error();
- if (phase->input_needs_mipmaps && generated_mipmaps->count(input) == 0) {
- glGenerateMipmap(GL_TEXTURE_2D);
- check_error();
- generated_mipmaps->insert(input);
- }
- setup_rtt_sampler(glsl_program_num, sampler, phase->effect_ids[input->output_node], phase->input_needs_mipmaps);
-
- string texture_name = string("tex_") + phase->effect_ids[input->output_node];
- glUniform1i(glGetUniformLocation(glsl_program_num, texture_name.c_str()), sampler);
- check_error();
- }
-
- // And now the output.