From e331c9d18e100b2b723918914ec8a97cfaeb6fa0 Mon Sep 17 00:00:00 2001
From: Hannu Hanhi <hhanhipublic@gmail.com>
Date: Thu, 23 Jul 2020 20:51:05 +0300
Subject: [PATCH] Fix OpenGL polyobject texture distortion

---
 src/hardware/hw_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index 0d7404c774..0db7a2a4ce 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -2757,8 +2757,8 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
 		HWR_SetCurrentTexture(NULL);
 
 	// reference point for flat texture coord for each vertex around the polygon
-	flatxref = (float)((polysector->origVerts[0].x & (~flatflag)) / fflatwidth);
-	flatyref = (float)((polysector->origVerts[0].y & (~flatflag)) / fflatheight);
+	flatxref = (float)(((fixed_t)FIXED_TO_FLOAT(polysector->origVerts[0].x) & (~flatflag)) / fflatwidth);
+	flatyref = (float)(((fixed_t)FIXED_TO_FLOAT(polysector->origVerts[0].y) & (~flatflag)) / fflatheight);
 
 	// transform
 	v3d = planeVerts;
-- 
GitLab