From fd5cf11e99a1f3823a02585a6dba513b2ac8047a Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 29 Nov 2025 14:25:55 +0100 Subject: [PATCH] ensure modelMatrix is initialized --- src/hardware/hw_clip.c | 15 ++++++++++----- src/hardware/r_opengl/r_opengl.c | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/hardware/hw_clip.c b/src/hardware/hw_clip.c index caa19f565..3f9536436 100644 --- a/src/hardware/hw_clip.c +++ b/src/hardware/hw_clip.c @@ -166,6 +166,7 @@ static void gld_clipper_RemoveRange(clipnode_t *range) { range->prev->next = range->next; } + if (range->next) { range->next->prev = range->prev; @@ -348,7 +349,7 @@ angle_t gld_FrustumAngle(angle_t tiltangle) // gld_FrustumSetup // -float frustum[6][4]; +static float frustum[6][4]; #define CALCMATRIX(a, b, c, d, e, f, g, h)\ (modelMatrix[a] * projMatrix[b] + \ @@ -361,16 +362,20 @@ float frustum[6][4]; frustum[i][0] * frustum[i][0] + \ frustum[i][1] * frustum[i][1] + \ frustum[i][2] * frustum[i][2]); \ - frustum[i][0] /= t; \ - frustum[i][1] /= t; \ - frustum[i][2] /= t; \ - frustum[i][3] /= t + frustum[i][0] /= t; \ + frustum[i][1] /= t; \ + frustum[i][2] /= t; \ + frustum[i][3] /= t void gld_FrustumSetup(void) { float t; float clip[16]; + // HWR_SetTransform will take care of this! + //pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix); + //pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); + clip[0] = CALCMATRIX(0, 0, 1, 4, 2, 8, 3, 12); clip[1] = CALCMATRIX(0, 1, 1, 5, 2, 9, 3, 13); clip[2] = CALCMATRIX(0, 2, 1, 6, 2, 10, 3, 14); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 72ff3881a..313b5f619 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -127,7 +127,7 @@ GLuint gl_num_extensions; int majorGL = 0, minorGL = 0; //Hurdler: 04/10/2000: added for the kick ass coronas as Boris wanted;-) -GLfloat modelMatrix[16]; +GLfloat modelMatrix[16] = {0}; GLfloat projMatrix[16] = {0}; static GLint viewport[4];