diff --git a/src/client/refresh/header/local.h b/src/client/refresh/header/local.h index bd91dc95..1216dbc6 100644 --- a/src/client/refresh/header/local.h +++ b/src/client/refresh/header/local.h @@ -217,7 +217,7 @@ extern cvar_t *gl_overbrightbits; extern cvar_t *gl_vertex_arrays; extern cvar_t *gl_ext_swapinterval; -extern cvar_t *gl_ext_palettedtexture; +extern cvar_t *gl_palettedtexture; extern cvar_t *gl_ext_multitexture; extern cvar_t *gl_pointparameters; extern cvar_t *gl_ext_compiled_vertex_array; @@ -381,6 +381,7 @@ typedef struct // ---- + qboolean palettedtexture; qboolean pointparameters; qboolean mtexcombine; diff --git a/src/client/refresh/r_draw.c b/src/client/refresh/r_draw.c index ff46daba..19fe3131 100644 --- a/src/client/refresh/r_draw.c +++ b/src/client/refresh/r_draw.c @@ -386,7 +386,7 @@ Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, byte *data) t = rows * hscale / 256 - 1.0 / 512.0; - if (!qglColorTableEXT) + if (!gl_config.palettedtexture) { unsigned *dest; diff --git a/src/client/refresh/r_image.c b/src/client/refresh/r_image.c index 3e0c473a..be100b06 100644 --- a/src/client/refresh/r_image.c +++ b/src/client/refresh/r_image.c @@ -131,7 +131,7 @@ R_SetTexturePalette(unsigned palette[256]) int i; unsigned char temptable[768]; - if (qglColorTableEXT && gl_ext_palettedtexture->value) + if (gl_config.palettedtexture) { for (i = 0; i < 256; i++) { @@ -751,7 +751,7 @@ R_Upload32Old(unsigned *data, int width, int height, qboolean mipmap) { if (!mipmap) { - if (qglColorTableEXT && gl_ext_palettedtexture->value && + if (qglColorTableEXT && gl_palettedtexture->value && (samples == gl_solid_format)) { uploaded_paletted = true; @@ -781,7 +781,7 @@ R_Upload32Old(unsigned *data, int width, int height, qboolean mipmap) R_LightScaleTexture(scaled, scaled_width, scaled_height, !mipmap); - if (qglColorTableEXT && gl_ext_palettedtexture->value && + if (qglColorTableEXT && gl_palettedtexture->value && (samples == gl_solid_format)) { uploaded_paletted = true; @@ -822,7 +822,7 @@ R_Upload32Old(unsigned *data, int width, int height, qboolean mipmap) miplevel++; - if (qglColorTableEXT && gl_ext_palettedtexture->value && + if (qglColorTableEXT && gl_palettedtexture->value && (samples == gl_solid_format)) { uploaded_paletted = true; @@ -896,7 +896,7 @@ R_Upload8(byte *data, int width, int height, qboolean mipmap, qboolean is_sky) VID_Error(ERR_DROP, "R_Upload8: too large"); } - if (qglColorTableEXT && gl_ext_palettedtexture->value && is_sky) + if (gl_config.palettedtexture && is_sky) { glTexImage2D(GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, width, height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, @@ -1347,7 +1347,7 @@ R_InitImages(void) Draw_GetPalette(); - if (qglColorTableEXT) + if (gl_config.palettedtexture) { FS_LoadFile("pics/16to8.dat", (void **)&gl_state.d_16to8table); diff --git a/src/client/refresh/r_main.c b/src/client/refresh/r_main.c index 31535db2..226230fa 100644 --- a/src/client/refresh/r_main.c +++ b/src/client/refresh/r_main.c @@ -96,7 +96,7 @@ cvar_t *gl_particle_att_b; cvar_t *gl_particle_att_c; cvar_t *gl_ext_swapinterval; -cvar_t *gl_ext_palettedtexture; +cvar_t *gl_palettedtexture; cvar_t *gl_ext_multitexture; cvar_t *gl_pointparameters; cvar_t *gl_ext_compiled_vertex_array; @@ -1256,7 +1256,7 @@ R_Register(void) gl_vertex_arrays = Cvar_Get("gl_vertex_arrays", "0", CVAR_ARCHIVE); gl_ext_swapinterval = Cvar_Get("gl_ext_swapinterval", "1", CVAR_ARCHIVE); - gl_ext_palettedtexture = Cvar_Get("gl_ext_palettedtexture", "0", CVAR_ARCHIVE); + gl_palettedtexture = Cvar_Get("gl_palettedtexture", "0", CVAR_ARCHIVE); gl_ext_multitexture = Cvar_Get("gl_ext_multitexture", "0", CVAR_ARCHIVE); gl_pointparameters = Cvar_Get("gl_pointparameters", "1", CVAR_ARCHIVE); gl_ext_compiled_vertex_array = Cvar_Get("gl_ext_compiled_vertex_array", "1", CVAR_ARCHIVE); @@ -1434,6 +1434,8 @@ R_Init(void *hinstance, void *hWnd) VID_Printf(PRINT_ALL, "\n\nProbing for OpenGL extensions:\n"); + // ---- + /* Point parameters */ VID_Printf(PRINT_ALL, "- Point parameters: "); @@ -1462,27 +1464,39 @@ R_Init(void *hinstance, void *hWnd) VID_Printf(PRINT_ALL, "Disabled\n"); } - if (!qglColorTableEXT && - strstr(gl_config.extensions_string, "GL_EXT_paletted_texture") && + // ---- + + /* Paletted texture */ + VID_Printf(PRINT_ALL, "- Paletted texture: "); + + if (strstr(gl_config.extensions_string, "GL_EXT_paletted_texture") && strstr(gl_config.extensions_string, "GL_EXT_shared_texture_palette")) { - if (gl_ext_palettedtexture->value) + qglColorTableEXT = (void (APIENTRY *)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid * )) + GLimp_GetProcAddress ("glColorTableEXT"); + } + + gl_config.palettedtexture = false; + + if (gl_palettedtexture->value) + { + if (qglColorTableEXT) { - VID_Printf(PRINT_ALL, "...using GL_EXT_shared_texture_palette\n"); - qglColorTableEXT = - (void (APIENTRY *)(GLenum, GLenum, GLsizei, GLenum, GLenum, - const GLvoid * ) ) GLimp_GetProcAddress ("glColorTableEXT"); + gl_config.palettedtexture = true; + VID_Printf(PRINT_ALL, "Okay\n"); } else { - VID_Printf(PRINT_ALL, "...ignoring GL_EXT_shared_texture_palette\n"); + VID_Printf(PRINT_ALL, "Failed\n"); } } else { - VID_Printf(PRINT_ALL, "...GL_EXT_shared_texture_palette not found\n"); + VID_Printf(PRINT_ALL, "Disabled\n"); } + // ---- + if (strstr(gl_config.extensions_string, "GL_ARB_multitexture")) { if (gl_ext_multitexture->value) diff --git a/src/client/refresh/r_misc.c b/src/client/refresh/r_misc.c index 8b24d6e7..a07d0c51 100644 --- a/src/client/refresh/r_misc.c +++ b/src/client/refresh/r_misc.c @@ -234,7 +234,7 @@ R_SetDefaultState(void) qglPointParameterfvARB(GL_DISTANCE_ATTENUATION_EXT, attenuations); } - if (qglColorTableEXT && gl_ext_palettedtexture->value) + if (gl_config.palettedtexture) { glEnable(GL_SHARED_TEXTURE_PALETTE_EXT); R_SetTexturePalette(d_8to24table); diff --git a/src/client/refresh/r_warp.c b/src/client/refresh/r_warp.c index 519cd2a2..95a1b909 100644 --- a/src/client/refresh/r_warp.c +++ b/src/client/refresh/r_warp.c @@ -735,7 +735,7 @@ R_SetSky(char *name, float rotate, vec3_t axis) for (i = 0; i < 6; i++) { - if (qglColorTableEXT && gl_ext_palettedtexture->value) + if (gl_config.palettedtexture) { Com_sprintf(pathname, sizeof(pathname), "env/%s%s.pcx", skyname, suf[i]);