From 5d7cb90bea9d4d4ad76facbcab29fb5971505535 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Fri, 17 Oct 2025 08:15:41 +0500 Subject: [PATCH] ref: gl: use our own matrix functions to create 2D projection and modelview matrices --- ref/gl/gl_draw.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ref/gl/gl_draw.c b/ref/gl/gl_draw.c index 71d5fdc7..cf6b4c1d 100644 --- a/ref/gl/gl_draw.c +++ b/ref/gl/gl_draw.c @@ -209,16 +209,21 @@ void R_Set2DMode( qboolean enable ) { if( enable ) { + matrix4x4 projection_matrix, worldview_matrix; + if( glState.in2DMode ) return; // set 2D virtual screen size pglViewport( 0, 0, gpGlobals->width, gpGlobals->height ); + pglMatrixMode( GL_PROJECTION ); - pglLoadIdentity(); - pglOrtho( 0, gpGlobals->width, gpGlobals->height, 0, -99999, 99999 ); + Matrix4x4_CreateOrtho( projection_matrix, 0, gpGlobals->width, gpGlobals->height, 0, -99999, 99999 ); + GL_LoadMatrix( projection_matrix ); + pglMatrixMode( GL_MODELVIEW ); - pglLoadIdentity(); + Matrix4x4_LoadIdentity( worldview_matrix ); + GL_LoadMatrix( worldview_matrix ); GL_Cull( GL_NONE );