mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-29 15:51:45 +00:00
Switch GL_EXT_paletted_texture to the new probing logic
This commit is contained in:
parent
9f0b5d067b
commit
43c9970772
6 changed files with 36 additions and 21 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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]);
|
||||
|
|
Loading…
Reference in a new issue