From 5535773521f3154811f4108c8236d0fbfc3f90bf Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Tue, 29 Mar 2022 20:16:22 +0200 Subject: [PATCH] GL1: Fix setting gl1_particle_square, fixes #805 both if GL pointparameters are used or not (though depending on driver and hardware the pointparameters-based particles *might* be always square or always round, regardless of gl1_particle_square - that's driver-bugs which we can't fix, disable pointparameters with `gl1_pointparameters 0` to work around it, or just use the GL3 renderer) --- src/client/refresh/gl1/gl1_main.c | 27 +++++++++++++++++---------- src/client/refresh/gl1/gl1_misc.c | 13 +++++++++++++ 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/client/refresh/gl1/gl1_main.c b/src/client/refresh/gl1/gl1_main.c index 149e4d0a..31e1c09c 100644 --- a/src/client/refresh/gl1/gl1_main.c +++ b/src/client/refresh/gl1/gl1_main.c @@ -1668,21 +1668,28 @@ RI_BeginFrame(float camera_separation) glEnable(GL_ALPHA_TEST); glColor4f(1, 1, 1, 1); - if (gl_config.pointparameters && gl1_particle_square->modified) + if (gl1_particle_square->modified) { - R_InitParticleTexture(); - - /* GL_POINT_SMOOTH is not implemented by some OpenGL - drivers, especially the crappy Mesa3D backends like - i915.so. That the points are squares and not circles - is not a problem by Quake II! */ - if (gl1_particle_square->value) + if (gl_config.pointparameters) { - glDisable(GL_POINT_SMOOTH); + /* GL_POINT_SMOOTH is not implemented by some OpenGL + drivers, especially the crappy Mesa3D backends like + i915.so. That the points are squares and not circles + is not a problem by Quake II! */ + if (gl1_particle_square->value) + { + glDisable(GL_POINT_SMOOTH); + } + else + { + glEnable(GL_POINT_SMOOTH); + } } else { - glEnable(GL_POINT_SMOOTH); + // particles aren't drawn as GL_POINTS, but as textured triangles + // => update particle texture to look square - or circle-ish + R_InitParticleTexture(); } gl1_particle_square->modified = false; diff --git a/src/client/refresh/gl1/gl1_misc.c b/src/client/refresh/gl1/gl1_misc.c index 4c4cf732..b7a0d478 100644 --- a/src/client/refresh/gl1/gl1_misc.c +++ b/src/client/refresh/gl1/gl1_misc.c @@ -211,6 +211,19 @@ R_SetDefaultState(void) qglPointParameterfARB(GL_POINT_SIZE_MIN_EXT, gl1_particle_min_size->value); qglPointParameterfARB(GL_POINT_SIZE_MAX_EXT, gl1_particle_max_size->value); qglPointParameterfvARB(GL_DISTANCE_ATTENUATION_EXT, attenuations); + + /* GL_POINT_SMOOTH is not implemented by some OpenGL + drivers, especially the crappy Mesa3D backends like + i915.so. That the points are squares and not circles + is not a problem by Quake II! */ + if (gl1_particle_square->value) + { + glDisable(GL_POINT_SMOOTH); + } + else + { + glEnable(GL_POINT_SMOOTH); + } } if (gl_config.palettedtexture)