glViewport(0, 0, width, height);
fbos.render_to(gray_tex);
glBindVertexArray(gray_vao);
- glUseProgram(gray_program);
glDisable(GL_BLEND);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
glViewport(0, 0, level_width, level_height);
fbos.render_to(grad0_tex);
- glUseProgram(sobel_program);
glDisable(GL_BLEND);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
GLuint motion_search_program;
GLuint uniform_inv_image_size, uniform_inv_prev_level_size;
- GLuint uniform_image0_tex, uniform_image1_tex, uniform_grad0_tex, uniform_flow_tex;
+ GLuint uniform_image1_tex, uniform_grad0_tex, uniform_flow_tex;
};
MotionSearch::MotionSearch()
uniform_inv_image_size = glGetUniformLocation(motion_search_program, "inv_image_size");
uniform_inv_prev_level_size = glGetUniformLocation(motion_search_program, "inv_prev_level_size");
- uniform_image0_tex = glGetUniformLocation(motion_search_program, "image0_tex");
uniform_image1_tex = glGetUniformLocation(motion_search_program, "image1_tex");
uniform_grad0_tex = glGetUniformLocation(motion_search_program, "grad0_tex");
uniform_flow_tex = glGetUniformLocation(motion_search_program, "flow_tex");
{
glUseProgram(motion_search_program);
- bind_sampler(motion_search_program, uniform_image0_tex, 0, tex0_view, nearest_sampler);
bind_sampler(motion_search_program, uniform_image1_tex, 1, tex1_view, linear_sampler);
- bind_sampler(motion_search_program, uniform_grad0_tex, 2, grad0_tex, zero_border_sampler);
+ bind_sampler(motion_search_program, uniform_grad0_tex, 2, grad0_tex, linear_sampler);
bind_sampler(motion_search_program, uniform_flow_tex, 3, flow_tex, linear_sampler);
glProgramUniform2f(motion_search_program, uniform_inv_image_size, 1.0f / level_width, 1.0f / level_height);
glViewport(0, 0, width_patches, height_patches);
fbos.render_to(flow_out_tex);
- glUseProgram(motion_search_program);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
// Create a new texture; we could be fancy and render use a multi-level
// texture, but meh.
- GLuint grad0_tex = pool.get_texture(GL_RG16F, level_width, level_height);
+ GLuint grad0_tex = pool.get_texture(GL_R32UI, level_width, level_height);
// Find the derivative.
{
glViewport(0, 0, level_width, level_height);
fbos.render_to(output_tex);
- glUseProgram(blend_program);
glDisable(GL_BLEND); // A bit ironic, perhaps.
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
ScopedTimer timer("Blend", &total_timer);
blend.exec(tex0, tex1, flow_tex, output_tex, width, height, alpha);
}
+ pool.release_texture(flow_tex);
total_timer.end();
timers.print();