View Full Version : GL_EXT_color_table
08-15-2002, 08:42 PM
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.
08-15-2002, 11:03 PM
08-15-2002, 11:10 PM
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'.
08-16-2002, 06:05 AM
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. http://www.opengl.org/discussion_boards/ubb/frown.gif Ah! I'm SOOOO MAD!!!! DAMNIT!!!
Ah! Sorry about that. I would apriciate some insite onto this extension if anybody has any. Thanks.
08-16-2002, 09:23 AM
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...
Good luck http://www.opengl.org/discussion_boards/ubb/smile.gif
08-16-2002, 10:19 AM
Well this is the code I'm using and it prints to the screen:
glColorTableEXT not found.
glColorTableEXT = (PFNGLCOLORTABLEEXTPROC) wglGetProcAddress("glColorTableEXT");
else printf("glColorTableEXT not found.\n");
glMultiTexCoord2DARB = (PFNGLMULTITEXCOORD2DARBPROC) wglGetProcAddress("glMultiTexCoord2dARB");
else printf("glMultiTexCoord2DARB not found.\n");
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.
08-16-2002, 02:18 PM
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.
08-16-2002, 03:43 PM
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!!??
08-16-2002, 11:57 PM
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.
08-17-2002, 04:11 AM
Okay, I think I'm on the right track now. Thank you all very much for your help.
08-17-2002, 11:51 AM
!!!!! http://www.opengl.org/discussion_boards/ubb/smile.gif I got it!!! It works now!!! http://www.opengl.org/discussion_boards/ubb/smile.gif http://www.opengl.org/discussion_boards/ubb/smile.gif http://www.opengl.org/discussion_boards/ubb/smile.gif
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.