I was looking through the Quake 2 source code and there are some opengl stuff that I’ve never heard of or seen before. They are glColorTableEXT() GL_COLOR_INDEX8_EXT and a few other things. Does anybody know what header these functions are in? What do I have to do to use this stuff in my own software? Thanks.
Those are basically extensions to support paletted textures. The extensions are easy enough to use. Look up glColorTableEXT in msdn (either online - http://msdn.microsoft.com/ - or on your own machine if you have msdn installed). The functionality should be explained quite fully there. If not try a google search for ‘opengl paletted texture tutorial’.
Does anybody actually know about this extension? Has anybody actually ever used it? I can’t seem to find the function anywhere. It’s got documentation on the internet but I can load it on any computer I have access to with wglGetProcAddress() and none of the tokens seem to be defined in any headers on my computer. You know I paid over $100 USD for my freiken radeon 8500 and it’s a pain in my ass the size of Texas that I can’t use a simple freiken extension that was saposively a GL 1.1 extention. Ah! I’m SOOOO MAD!!! DAMNIT!!!
Ah! Sorry about that. I would apriciate some insite onto this extension if anybody has any. Thanks.
OK. Here’s a couple of code fragments from an old project of mine that (hopefully) will get you started.
PFNGLCOLORTABLEEXTPROC glColorTableEXT = NULL;
glColorTableEXT = (PFNGLCOLORTABLEEXTPROC)wglGetProcAddress(“glColorTableEXT”);
if ( glColorTableEXT )
// How many colours are in the palette?
NumPalColours = (ui32) pow ( 2 , pOpenglTempRaster->Depth );
// If we do have hardware support, define a paletted texture…
glColorTableEXT ( GL_TEXTURE_2D , GL_RGBA8 , NumPalColours , GL_BGRA_EXT , GL_UNSIGNED_BYTE , pOpenglTempRaster->pPalette );
// Set the texture
glTexImage2D(GL_TEXTURE_2D , 0 , GL_COLOR_INDEX8_EXT, pOpenglTempRaster->Width , pOpenglTempRaster->Height , 0 , GL_COLOR_INDEX , GL_UNSIGNED_BYTE , pOpenglTempRaster->pPixels );
// We’re done here…
Please note that these fragments came from various different functions. I assume that you’re savvy enough to be able to make correct use of this info. As I said before, I’m pretty sure that msdn gives a good account of the use of this functionality…
Well this is the code I’m using and it prints to the screen:
glColorTableEXT not found.
glColorTableEXT = (PFNGLCOLORTABLEEXTPROC) wglGetProcAddress("glColorTableEXT"); if(glColorTableEXT) printf("glColorTableEXT loaded.
else printf("glColorTableEXT not found.
glMultiTexCoord2DARB = (PFNGLMULTITEXCOORD2DARBPROC) wglGetProcAddress("glMultiTexCoord2dARB"); if(glMultiTexCoord2DARB) printf("glMultiTexCoord2DARB loaded.
else printf("glMultiTexCoord2DARB not found.
so I guess my OpenGL 1.3.1 drivers don’t support it. I’ll just have to figure out another way to load a quake 2 .WAL texture. I do apriciate your help. Thanks.
Just look for function GL_Upload8 in Quake2 source code (it is in gl_image.c file).
There is code for transforming paletted image into RGB image.
Hope this helps.
Yes, mproso, that does help. Agh! The Quake 2 source is so complicated… no documentation… not very selfdocumenting either… You wouldn’t happen to know the specs of that gl_upload8 do you? What is *data pointing to? is it the color palette? Where do I load the palette from? How many bytes is it? Agh! Why must thing be so difficult???
Data is pointing to paletted image.
Trans is buffer where they store transformed
image from paletted format to RGBA format,
they use d_8to24table to do this.This table is created in Draw_GetPalette function.
Just read through code and be patient ;-).
Hope this helps.
Okay, I think I’m on the right track now. Thank you all very much for your help.
!!! I got it!!! It works now!!!