]> git.sesse.net Git - nageru/commitdiff
Avoid infinities in a uniform.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 20 Jul 2018 09:32:37 +0000 (11:32 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 20 Jul 2018 20:16:00 +0000 (22:16 +0200)
flow.cpp

index 5e93cd8daa208da92fc0a698628370038cd9716e..11f4d4c87646ba31d5c9d2c485386f848c6613d1 100644 (file)
--- a/flow.cpp
+++ b/flow.cpp
@@ -386,6 +386,8 @@ void Densify::exec(GLuint tex0_view, GLuint tex1_view, GLuint flow_tex, GLuint d
 
        float patch_spacing_x = float(level_width - patch_size_pixels) / (width_patches - 1);
        float patch_spacing_y = float(level_height - patch_size_pixels) / (height_patches - 1);
+       if (width_patches == 1) patch_spacing_x = 0.0f;  // Avoid infinities.
+       if (height_patches == 1) patch_spacing_y = 0.0f;
        glProgramUniform2f(densify_program, uniform_patch_spacing,
                patch_spacing_x / level_width,
                patch_spacing_y / level_height);