- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0, 1.0, 0.0, 1.0, 0.0, 1.0);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
- if (phases.size() > 1) {
- glBindFramebuffer(GL_FRAMEBUFFER, fbo);
- check_error();
- }
-
- std::set<Node *> generated_mipmaps;
-
- for (unsigned phase = 0; phase < phases.size(); ++phase) {
- // See if the requested output size has changed. If so, we need to recreate
- // the texture (and before we start setting up inputs).
- inform_input_sizes(phases[phase]);
- if (phase != phases.size() - 1) {
- find_output_size(phases[phase]);
-
- Node *output_node = phases[phase]->effects.back();
-
- if (output_node->output_texture_width != phases[phase]->output_width ||
- output_node->output_texture_height != phases[phase]->output_height) {
- glActiveTexture(GL_TEXTURE0);
- check_error();
- glBindTexture(GL_TEXTURE_2D, output_node->output_texture);
- check_error();
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, phases[phase]->output_width, phases[phase]->output_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- check_error();
- glBindTexture(GL_TEXTURE_2D, 0);
- check_error();
-
- output_node->output_texture_width = phases[phase]->output_width;
- output_node->output_texture_height = phases[phase]->output_height;
- }
- }
-
- glUseProgram(phases[phase]->glsl_program_num);
- check_error();