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)
This commit is contained in:
Daniel Gibson 2022-03-29 20:16:22 +02:00
parent f7386eb296
commit 5535773521
2 changed files with 30 additions and 10 deletions

View File

@ -1668,10 +1668,10 @@ 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)
{
if (gl_config.pointparameters)
{
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
@ -1684,6 +1684,13 @@ RI_BeginFrame(float camera_separation)
{
glEnable(GL_POINT_SMOOTH);
}
}
else
{
// 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;
}

View File

@ -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)