Thanks for the quick reply.
I’m getting error 1282 (invalid operation) after glColorTable(GL_TEXTURE_2D, GL_RGBA, 256, GL_RGBA, GL_FLOAT, palette);
The basic setup is:
/* dist is a 256x256 unsigned byte array of values */
glGenTextures(1, &distTex);
glBindTexture(GL_TEXTURE_2D, distTex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, 256, 256, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, dist);
glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* …and to draw */
glEnable(GL_BLEND);
glBindTexture(GL_TEXTURE_2D, distTex);
glColorTable(GL_TEXTURE_2D, GL_RGBA, 256, GL_RGBA, GL_FLOAT, palette);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2i(0, 0);
glTexCoord2f(1, 0);
glVertex2i(width, 0);
glTexCoord2f(1, 1);
glVertex2i(width, height);
glTexCoord2f(0, 1);
glVertex2i(0, height);
glEnd();
Also, as an aside, I’m also having problems with GL_INTENSITY format textures. The glTexImage2D call fails with 1280 (invalid enumerant).
Thanks,
J