how to use PFNGLCOLORTABLEEXTPROC??

Started by
3 comments, last by HuntsMan 15 years, 8 months ago
I want to use a look_up table for the texture pixels. now i found that "glColorTableEXT" might help. my code is : glEnable(GL_COLOR_TABLE); glEnable(GL_SHARED_TEXTURE_PALETTE_EXT); glTexImage2D(GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, pack->width, pack->height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, pack->texture); and use: PFNGLCOLORTABLEEXTPROC glColorTableEXT = (PFNGLCOLORTABLEEXTPROC) wglGetProcAddress("glColorTableEXT"); glColorTableEXT (GL_SHARED_TEXTURE_PALETTE_EXT, GL_RGBA, 256, GL_RGBA, GL_UNSIGNED_BYTE, rgba_table); to set the lookup table, but the question is that i dont know how to set the rgba_table of the glColorTableEXT? what is that "void* parameter" 's structure? How can i construct the rgba_table? and how opengl look up a color through the table? Can anyone help me? thx~~~~~~
Advertisement
I think that should be
glColorTableEXT(GL_TEXTURE_2D, GL_RGBA8, 256, GL_RGBA, GL_UNSIGNED_BYTE, rgba_table);

and rgba_table should be an array of 256 elements
GLubyte rgba_table[256];
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
does that mean the pixel value range of the texture image is 0~255?
so an table of 256 entries will work...
GL_EXT_shared_texture_palette extension seems not supported on my GeForce 8500GT graphic card........
i just want to implement a feature that the texture could be dynamicly modified based on a lookup table, which pixel value of the image is a index and corresponding entry is the color.so i can just change the table and texture will be changed.....
anyone have any idea to implement it without using the GL_EXT_shared_texture_palette????
thx~~~~~
Quote:Original post by alexsando
GL_EXT_shared_texture_palette extension seems not supported on my GeForce 8500GT graphic card........
i just want to implement a feature that the texture could be dynamicly modified based on a lookup table, which pixel value of the image is a index and corresponding entry is the color.so i can just change the table and texture will be changed.....
anyone have any idea to implement it without using the GL_EXT_shared_texture_palette????
thx~~~~~


Well you can do it using GLSL Shaders.

This topic is closed to new replies.

Advertisement