2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-12-28 03:35:19 +01:00

ref: gl: don't touch polygon offset when not drawing debug hulls as it breaks decals with VBO

Also correctly restore polygon offset state so decals gets drawn even with VBO
This commit is contained in:
Alibek Omarov 2024-11-05 23:57:51 +03:00
parent c3b6422ad0
commit 159ded433d

View File

@ -1746,10 +1746,20 @@ void R_DrawBrushModel( cl_entity_t *e )
pglDisable( GL_BLEND );
pglDepthMask( GL_TRUE );
pglPolygonOffset( 1.0f, 2.0f );
pglEnable( GL_POLYGON_OFFSET_FILL );
gEngfuncs.R_DrawModelHull( clmodel ); // draw before restore
pglDisable( GL_POLYGON_OFFSET_FILL );
if( r_showhull->value > 0.0f )
{
GLfloat factor, units;
pglGetFloatv( GL_POLYGON_OFFSET_FACTOR, &factor );
pglGetFloatv( GL_POLYGON_OFFSET_UNITS, &units );
pglPolygonOffset( 1.0f, 2.0f );
pglEnable( GL_POLYGON_OFFSET_FILL );
gEngfuncs.R_DrawModelHull( clmodel ); // draw before restore
pglDisable( GL_POLYGON_OFFSET_FILL );
pglPolygonOffset( factor, units );
}
R_LoadIdentity(); // restore worldmatrix
}