From 1eb1d8d280d86370f3f5dd022c0e97334bc0896c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 9 Sep 2018 08:57:50 +0200 Subject: [PATCH] - fixed math imprecisions in horizon vertex generation. Floats are not precise enough to be used as a loop counter. --- src/gl/scene/gl_portal.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gl/scene/gl_portal.cpp b/src/gl/scene/gl_portal.cpp index 3ef4e2e3e..5820f11df 100644 --- a/src/gl/scene/gl_portal.cpp +++ b/src/gl/scene/gl_portal.cpp @@ -343,10 +343,12 @@ GLHorizonPortal::GLHorizonPortal(FPortalSceneState *s, GLHorizonInfo * pt, FRend // Draw to some far away boundary // This is not drawn as larger strips because it causes visual glitches. FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer(); - for (float x = -32768 + vx; x<32768 + vx; x += 4096) + for (int xx = -32768; xx < 32768; xx += 4096) { - for (float y = -32768 + vy; y<32768 + vy; y += 4096) + float x = xx + vx; + for (int yy = -32768; yy < 32768; yy += 4096) { + float y = yy + vy; ptr->Set(x, z, y, x / 64, -y / 64); ptr++; ptr->Set(x + 4096, z, y, x / 64 + 64, -y / 64);