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?