Parameterize the linear filtering of scrap textures.

This commit is contained in:
Bill Currie 2012-07-03 12:10:24 +09:00
parent e170f4ee75
commit df35b22af4
3 changed files with 10 additions and 6 deletions

View file

@ -52,7 +52,7 @@ int GLSL_LoadRGBATexture (const char *identifier, int width, int height,
void GLSL_ReleaseTexture (int tex); void GLSL_ReleaseTexture (int tex);
void GLSL_TextureInit (void); void GLSL_TextureInit (void);
scrap_t *GLSL_CreateScrap (int size, int format); scrap_t *GLSL_CreateScrap (int size, int format, int linear);
void GLSL_DestroyScrap (scrap_t *scrap); void GLSL_DestroyScrap (scrap_t *scrap);
void GLSL_ScrapClear (scrap_t *scrap); void GLSL_ScrapClear (scrap_t *scrap);
int GLSL_ScrapTexture (scrap_t *scrap); int GLSL_ScrapTexture (scrap_t *scrap);

View file

@ -200,7 +200,7 @@ glsl_R_BuildLightmaps (model_t **models, int num_models)
//FIXME RGB support //FIXME RGB support
if (!light_scrap) { if (!light_scrap) {
light_scrap = GLSL_CreateScrap (2048, GL_LUMINANCE); light_scrap = GLSL_CreateScrap (2048, GL_LUMINANCE, 1);
light_data = malloc (BLOCK_SIZE * MAX_LIGHTMAPS); light_data = malloc (BLOCK_SIZE * MAX_LIGHTMAPS);
} else { } else {
GLSL_ScrapClear (light_scrap); GLSL_ScrapClear (light_scrap);

View file

@ -279,7 +279,7 @@ GLSL_TextureInit (void)
} }
scrap_t * scrap_t *
GLSL_CreateScrap (int size, int format) GLSL_CreateScrap (int size, int format, int linear)
{ {
int i; int i;
int bpp; int bpp;
@ -326,9 +326,13 @@ GLSL_CreateScrap (int size, int format)
size, size, 0, format, GL_UNSIGNED_BYTE, scrap->data); size, size, 0, format, GL_UNSIGNED_BYTE, scrap->data);
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
//FIXME parameterize (linear for lightmaps) if (linear) {
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
} else {
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
qfeglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
qfeglGenerateMipmap (GL_TEXTURE_2D); qfeglGenerateMipmap (GL_TEXTURE_2D);
return scrap; return scrap;