How to use glColorTable(attach code)

this is my code:

  GLubyte table[256][4];   
	int i;   

	for (i=0;i<256;i++) {      
		table[i][0] = 255;      
		table[i][1] = 0;      
		table[i][2] = 0;      
		table[i][3] = 255;   
	}


	glColorTable(GL_COLOR_TABLE,   
	             GL_RGBA8,
	             256,
		     GL_RGBA,
                     GL_UNSIGNED_BYTE,
		     table);

	BYTE texture[8*8];
	for(i=0; i<8*8; i++)
	{
		texture[i] = i;
	} 

glBindTexture(GL_TEXTURE_2D, TextureIndex); 

glTexParameteri(GL_TEXTURE_3D,
GL_TEXTURE_WRAP_S, GL_REPEAT);
  
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT); 
 
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);  

glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);  

glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);  

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);  

glTexImage2D(GL_TEXTURE_2D,              
	     0,					
	     GL_COLOR_INDEX8_EXT,           
	     8, 8,		       
	     0,			               
	     GL_COLOR_INDEX,		
	     GL_UNSIGNED_BYTE,	           
	     texture);

Is anyting Wrong? If it was correct, the texture
color should be red. But it’s not red. why?

Wehcle Farbe ist es? Vieleicht ist blau.

Shouldn’t it be glColorTable( GL_TEXTURE_3D, … ) ?
Or is it GL_TEXTURE_2D?
It seems that you found a way to mix them freely… :rolleyes:

GL_EXT_paletted_texture

oh, That was a mistake. It should be GL_TEXTURE_2D all. But my triangle still have wrong color. oh,glColotTable make me headache

Are you sure that your 3D card actually has GL_EXT_paletted_texture extension?
It wasn’t that widely supported, and even NVIDIA dropped it.