Okay, one more try.

This commit is contained in:
Jeff Teunissen 2000-11-16 23:23:53 +00:00
parent 5d69bb1342
commit aad43f6d00

View file

@ -295,16 +295,22 @@ void
// Check for 8bit Extensions and initialize them. // Check for 8bit Extensions and initialize them.
int i; int i;
if (is8bit) {
return;
}
if (strstr (gl_extensions, "3DFX_set_global_palette")) { if (strstr (gl_extensions, "3DFX_set_global_palette")) {
char *oldpal; char *oldpal;
GLubyte table[256][4]; GLubyte table[256][4];
gl3DfxSetPaletteEXT_FUNC load_texture = NULL; gl3DfxSetPaletteEXT_FUNC qgl3DfxSetPaletteEXT = NULL;
if (!(qgl3DfxSetPaletteEXT = (void *) dlsym (dlhand, "gl3DfxSetPaletteEXT"))) {
return;
}
Con_Printf ("3DFX_set_global_palette.\n"); Con_Printf ("3DFX_set_global_palette.\n");
load_texture = (void *) dlsym (dlhand, "gl3DfxSetPaletteEXT");
glEnable (GL_SHARED_TEXTURE_PALETTE_EXT); glEnable (GL_SHARED_TEXTURE_PALETTE_EXT);
oldpal = (char *) d_8to24table; //d_8to24table3dfx; oldpal = (char *) d_8to24table; //d_8to24table3dfx;
for (i = 0; i < 256; i++) { for (i = 0; i < 256; i++) {
@ -314,56 +320,50 @@ void
table[i][3] = 255; table[i][3] = 255;
oldpal++; oldpal++;
} }
load_texture ((GLuint *) table); qgl3DfxSetPaletteEXT ((GLuint *) table);
is8bit = true; is8bit = true;
# ifdef GL_SHARED_TEXTURE_PALETTE_EXT
} else {
Shared_Init8bitPalette ();
# endif
} }
Con_Printf ("not found.\n");
} }
#endif #endif
#ifdef GL_SHARED_TEXTURE_PALETTE_EXT #ifdef GL_SHARED_TEXTURE_PALETTE_EXT
#ifndef PFNGLCOLORTABLEPROC //#ifndef PFNGLCOLORTABLEEXTPROC
typedef void (APIENTRY * PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); //typedef void (APIENTRY * PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
#endif //#endif
void void
Shared_Init8bitPalette (void) Shared_Init8bitPalette (void)
{ {
int i; int i;
char thePalette[256*3]; GLubyte thePalette[256][3];
char *oldPalette, *newPalette; char *oldPalette;
PFNGLCOLORTABLEPROC qglColorTable = NULL; PFNGLCOLORTABLEEXTPROC qglColorTableEXT = NULL;
if (strstr (gl_extensions, "GL_EXT_shared_texture_palette") == NULL) { if (is8bit) {
return; return;
} }
if (!(qglColorTable = (void *) dlsym (dlhand, "glColorTable"))) { if (strstr (gl_extensions, "GL_EXT_shared_texture_palette")) {
if (!(qglColorTable = (void *) dlsym (dlhand, "glColorTableEXT"))) { if (!(qglColorTableEXT = (void *) dlsym (dlhand, "glColorTableEXT"))) {
return; return;
} }
}
Con_Printf ("8-bit GL extensions enabled.\n"); Con_Printf ("GL_EXT_shared_texture_palette\n");
glEnable (GL_SHARED_TEXTURE_PALETTE_EXT); glEnable (GL_SHARED_TEXTURE_PALETTE_EXT);
oldPalette = (char *) d_8to24table; //d_8to24table3dfx; oldPalette = (char *) d_8to24table; //d_8to24table3dfx;
newPalette = thePalette;
for (i = 0; i < 256; i++) { for (i = 0; i < 256; i++) {
*newPalette++ = *oldPalette++; thePalette[i][0] = *oldPalette++;
*newPalette++ = *oldPalette++; thePalette[i][1] = *oldPalette++;
*newPalette++ = *oldPalette++; thePalette[i][2] = *oldPalette++;
oldPalette++; oldPalette++;
} }
is8bit = true;
qglColorTable (GL_SHARED_TEXTURE_PALETTE_EXT, GL_RGB, 256, GL_RGB, GL_UNSIGNED_BYTE, (void *) thePalette); qglColorTableEXT (GL_SHARED_TEXTURE_PALETTE_EXT, GL_RGB, 256, GL_RGB, GL_UNSIGNED_BYTE, (void *) thePalette);
is8bit = true;
}
} }
#endif #endif
@ -393,6 +393,9 @@ VID_Init8bitPalette (void)
Shared_Init8bitPalette(); Shared_Init8bitPalette();
# endif # endif
#endif #endif
if (!is8bit) {
Con_Printf ("not found.\n");
}
dlclose (dlhand); dlclose (dlhand);
dlhand = NULL; dlhand = NULL;
} }