glViewport(0, 0, width, height);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
- glDepthFunc(GL_LESS); // We store the difference between I_0 and I_1, where less difference is good. (Default is effectively +inf, which always loses.)
+ glDepthFunc(GL_LESS); // We store the difference between I_0 and I_1, where less difference is good. (Default 1.0 is effectively +inf, which always loses.)
glBindVertexArray(splat_vao);
// FIXME: Get this into FBOSet, so we can reuse FBOs across frames.
{
ScopedTimer timer("Clear", &total_timer);
glClearTexImage(flow_tex, 0, GL_RG, GL_FLOAT, nullptr);
- float infinity = 1000000.0f;
+ float infinity = 1.0f;
glClearTexImage(depth_tex, 0, GL_DEPTH_COMPONENT, GL_FLOAT, &infinity);
}
vec3 I_0 = texture(image0_tex, image_pos + I_0_check_offset).rgb;
vec3 I_1 = texture(image1_tex, image_pos + I_1_check_offset).rgb;
vec3 diff = abs(I_1 - I_0);
- gl_FragDepth = diff.x + diff.y + diff.z;
+ gl_FragDepth = 0.125 * (diff.x + diff.y + diff.z); // Make sure we stay well under the 1.0 maximum.
}