glTexImage with integer creates INVALID OPERATION

Hi there!

I want to use a texture as a lookup table for integers in shaders.
(if that’s not the way to do it nowadays, please give me a hint)

That’s how I want to create the texture and upload the data from the client array values:

int values[256]= {0, 1, ..., 255};

GLuint textureID;
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_1D, textureID);

glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

glTexImage1D(GL_TEXTURE_1D, 0, GL_R32I, 256, 0, GL_RED, GL_INT, values);


Sadly glTexImage creates an INVALID_OPERATION error.
Can anybody tell me, how to get integers into a texture?

Thanks,
bdysk

Solution:

GL_RED_INTEGER

http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=268211

Atleast it throws no error :wink: