GLuint motion_search_program;
GLuint motion_search_vao;
- GLuint uniform_image_size, uniform_inv_image_size, uniform_inv_prev_level_size;
+ GLuint uniform_image_size, uniform_inv_image_size, uniform_inv_flow_size, uniform_inv_prev_level_size;
GLuint uniform_image0_tex, uniform_image1_tex, uniform_grad0_tex, uniform_flow_tex;
};
uniform_image_size = glGetUniformLocation(motion_search_program, "image_size");
uniform_inv_image_size = glGetUniformLocation(motion_search_program, "inv_image_size");
+ uniform_inv_flow_size = glGetUniformLocation(motion_search_program, "inv_flow_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");
glProgramUniform2f(motion_search_program, uniform_image_size, level_width, level_height);
glProgramUniform2f(motion_search_program, uniform_inv_image_size, 1.0f / level_width, 1.0f / level_height);
+ glProgramUniform2f(motion_search_program, uniform_inv_flow_size, 1.0f / width_patches, 1.0f / height_patches);
glProgramUniform2f(motion_search_program, uniform_inv_prev_level_size, 1.0f / prev_level_width, 1.0f / prev_level_height);
glViewport(0, 0, width_patches, height_patches);
out vec2 flow_tc;
out vec2 patch_bottom_left_texel; // Center of bottom-left texel of patch.
-uniform float inv_flow_width, inv_flow_height;
-uniform float inv_image_width, inv_image_height;
+uniform vec2 inv_flow_size, inv_image_size;
void main()
{
gl_Position = vec4(2.0 * position.x - 1.0, 2.0 * position.y - 1.0, -1.0, 1.0);
flow_tc = position;
- vec2 patch_bottom_left = position - vec2(0.5, 0.5) * vec2(inv_flow_width, inv_flow_height);
- patch_bottom_left_texel = patch_bottom_left + vec2(0.5, 0.5) * vec2(inv_image_width, inv_image_height);
+ vec2 patch_bottom_left = position - vec2(0.5, 0.5) * inv_flow_size;
+ patch_bottom_left_texel = patch_bottom_left + vec2(0.5, 0.5) * inv_image_size;
}