From 17e24bb8e294e4ff2dd5f13cac87219d7f76207c Mon Sep 17 00:00:00 2001
From: Alug <alufoliehorst@gmail.com>
Date: Sat, 30 Mar 2024 00:14:48 +0100
Subject: [PATCH] Fix OGL shearing visually breaking when looking 90 degrees up
 or down

---
 src/r_fps.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/r_fps.c b/src/r_fps.c
index 9cbee9c0d..7b23ce6d5 100644
--- a/src/r_fps.c
+++ b/src/r_fps.c
@@ -23,6 +23,10 @@
 #include "z_zone.h"
 #include "console.h" // con_startup_loadprogress
 
+#ifdef HWRENDER
+#include "hardware/hw_main.h" // for cv_grshearing
+#endif
+
 static CV_PossibleValue_t fpscap_cons_t[] = {
 #ifdef DEVELOP
 	// Lower values are actually pretty useful for debugging interp problems!
@@ -119,7 +123,11 @@ static void R_SetupFreelook(player_t *player, boolean skybox)
 
 	// clip it in the case we are looking a hardware 90 degrees full aiming
 	// (lmps, network and use F12...)
-	if (rendermode == render_soft)
+	if (rendermode == render_soft
+#ifdef HWRENDER
+	|| (rendermode == render_opengl && cv_grshearing.value)
+#endif
+	)
 	{
 		G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
 	}
-- 
GitLab