Add case for when gl point parameters are not supported

This commit is contained in:
Mason UnixBeard 2019-12-05 19:30:59 -07:00 committed by Yamagi
parent af45aa56f1
commit 6a9f0c46d7
3 changed files with 42 additions and 16 deletions

View file

@ -1671,22 +1671,8 @@ RI_BeginFrame(float camera_separation)
if (gl1_particle_square->modified)
{
R_InitParticleTexture();
gl1_particle_square->modified = false;
/* yamagi: 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! */
switch ((int)gl1_particle_square->value)
{
default:
glDisable(GL_POINT_SMOOTH);
break;
case 0:
glEnable(GL_POINT_SMOOTH);
break;
}
}
/* draw buffer stuff */

View file

@ -45,6 +45,25 @@ static byte dottexture[16][16] = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
};
static byte squaretexture[16][16] = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0},
{0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0},
{0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0},
{0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0},
{0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0},
{0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0},
{0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0},
{0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
};
static byte notex[4][4] = {
{0, 0, 0, 0},
{0, 0, 1, 1},
@ -68,6 +87,13 @@ R_InitParticleTexture(void)
byte partData[16][16][4];
byte notexData[8][8][4];
byte (*sourcetexture)[16][16] = &dottexture;
if (gl1_particle_square->value)
{
sourcetexture = &squaretexture;
}
/* particle texture */
for (x = 0; x < 16; x++)
{
@ -76,7 +102,7 @@ R_InitParticleTexture(void)
partData[y][x][0] = 255;
partData[y][x][1] = 255;
partData[y][x][2] = 255;
partData[y][x][3] = dottexture[x][y] * 85;
partData[y][x][3] = *sourcetexture[x][y] * 85;
}
}
@ -189,6 +215,19 @@ R_SetDefaultState(void)
attenuations[1] = gl1_particle_att_b->value;
attenuations[2] = gl1_particle_att_c->value;
/* 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);
}
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);

View file

@ -187,6 +187,7 @@ extern cvar_t *gl1_particle_size;
extern cvar_t *gl1_particle_att_a;
extern cvar_t *gl1_particle_att_b;
extern cvar_t *gl1_particle_att_c;
extern cvar_t *gl1_particle_square;
extern cvar_t *r_mode;
extern cvar_t *r_customwidth;