From: Steinar H. Gunderson Date: Fri, 20 Jul 2018 09:32:37 +0000 (+0200) Subject: Avoid infinities in a uniform. X-Git-Tag: 1.8.0~76^2~219 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=dac59bd006c3ee244634f1bcdfdd2b1237db99d1;p=nageru Avoid infinities in a uniform. --- diff --git a/flow.cpp b/flow.cpp index 5e93cd8..11f4d4c 100644 --- 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);