Hi,
I’m trying to write what I think should be a very simple shader that does the following:
I have an image file with the dimensions: w=256 h=1
I’d like to write a shader that allows the calling program to specify an index between 0 and 255 and the shader looks up the pixel at that index within the image file and returns its color through the frag shader.
I’ve been looking at texelFetch and a few other things, but can’t figure out how to make them work for this purpose. Can anyone help me out? Thanks.
Quite unfortunate. This way you have to do it in the old way. This means you should set filtering to GL_NEAREST with no mipmaps, use the following shader:
Hey,
Thanks, that’s great. I’ve got it working in OpenGL Shader Builder. But I don’t seem to have the filtering part setup right in my program. Are these what I want:
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);