Always specify the alpha channel.

This is based upon the original OpenGL ES patch by Scott "pickle"
Smith. This change gives about the same frame rate on an 750TI but
about 3% more frames on an Ivy Bridge IGP with Mesa3D...
This commit is contained in:
Yamagi Burmeister 2016-08-04 20:48:05 +02:00
parent 4ae8706d22
commit 275271c647
5 changed files with 17 additions and 18 deletions

View file

@ -260,8 +260,7 @@ Draw_Fill(int x, int y, int w, int h, int c)
glDisable(GL_TEXTURE_2D);
color.c = d_8to24table[c];
glColor3f(color.v[0] / 255.0, color.v[1] / 255.0,
color.v[2] / 255.0);
glColor4f(color.v[0] / 255.0, color.v[1] / 255.0, color.v[2] / 255.0, 1);
glBegin(GL_QUADS);
@ -271,7 +270,7 @@ Draw_Fill(int x, int y, int w, int h, int c)
glVertex2f(x, y + h);
glEnd();
glColor3f(1, 1, 1);
glColor4f(1, 1, 1, 1);
glEnable(GL_TEXTURE_2D);
}

View file

@ -43,11 +43,11 @@ qboolean R_Upload8(byte *data, int width, int height,
qboolean mipmap, qboolean is_sky);
qboolean R_Upload32(unsigned *data, int width, int height, qboolean mipmap);
int gl_solid_format = 3;
int gl_alpha_format = 4;
int gl_solid_format = GL_RGB;
int gl_alpha_format = GL_RGBA;
int gl_tex_solid_format = 3;
int gl_tex_alpha_format = 4;
int gl_tex_solid_format = GL_RGB;
int gl_tex_alpha_format = GL_RGBA;
int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST;
int gl_filter_max = GL_LINEAR;
@ -78,7 +78,7 @@ typedef struct
} gltmode_t;
gltmode_t gl_alpha_modes[] = {
{"default", 4},
{"default", GL_RGBA},
{"GL_RGBA", GL_RGBA},
{"GL_RGBA8", GL_RGBA8},
{"GL_RGB5_A1", GL_RGB5_A1},
@ -89,7 +89,7 @@ gltmode_t gl_alpha_modes[] = {
#define NUM_GL_ALPHA_MODES (sizeof(gl_alpha_modes) / sizeof(gltmode_t))
gltmode_t gl_solid_modes[] = {
{"default", 3},
{"default", GL_RGB},
{"GL_RGB", GL_RGB},
{"GL_RGB8", GL_RGB8},
{"GL_RGB5", GL_RGB5},

View file

@ -47,8 +47,8 @@ R_RenderDlight(dlight_t *light)
VectorSubtract(light->origin, r_origin, v);
glBegin(GL_TRIANGLE_FAN);
glColor3f(light->color[0] * 0.2, light->color[1] * 0.2,
light->color[2] * 0.2);
glColor4f(light->color[0] * 0.2, light->color[1] * 0.2,
light->color[2] * 0.2, 1);
for (i = 0; i < 3; i++)
{
@ -56,7 +56,7 @@ R_RenderDlight(dlight_t *light)
}
glVertex3fv(v);
glColor3f(0, 0, 0);
glColor4f(0, 0, 0, 1);
for (i = 16; i >= 0; i--)
{
@ -101,7 +101,7 @@ R_RenderDlights(void)
R_RenderDlight(l);
}
glColor3f(1, 1, 1);
glColor4f(1, 1, 1, 1);
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

View file

@ -280,7 +280,7 @@ R_DrawNullModel(void)
R_RotateForEntity(currententity);
glDisable(GL_TEXTURE_2D);
glColor3fv(shadelight);
glColor4f( shadelight[0], shadelight[1], shadelight[2], 1 );
glBegin(GL_TRIANGLE_FAN);
glVertex3f(0, 0, -16);
@ -302,7 +302,7 @@ R_DrawNullModel(void)
glEnd();
glColor3f(1, 1, 1);
glColor4f(1, 1, 1, 1);
glPopMatrix();
glEnable(GL_TEXTURE_2D);
}
@ -536,7 +536,7 @@ R_PolyBlend(void)
glRotatef(-90, 1, 0, 0); /* put Z going up */
glRotatef(90, 0, 0, 1); /* put Z going up */
glColor4fv(v_blend);
glColor4f(v_blend[0], v_blend[1], v_blend[2], v_blend[3]);
glBegin(GL_QUADS);

View file

@ -916,7 +916,7 @@ R_DrawBrushModel(entity_t *e)
glEnable(GL_POLYGON_OFFSET_FILL);
}
glColor3f(1, 1, 1);
glColor4f(1, 1, 1, 1);
memset(gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
VectorSubtract(r_newrefdef.vieworg, e->origin, modelorg);
@ -1165,7 +1165,7 @@ R_DrawWorld(void)
gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1;
glColor3f(1, 1, 1);
glColor4f(1, 1, 1, 1);
memset(gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
R_ClearSkyBox();