I’m writing a shader in GLSL and I need to pass it a certain amount of information. The only practical way to pass this information is using a 1-D texture.
I’m creating the texture and setting GL_TEXTURE_MIN_FILTER and GL_TEXTURE_MAG_FILTER to GL_NEAREST
Now from the shader I need to access the texture so I’ll be able to exactly index each and every number 3-value vector I put into it.
What is a sure-fire way to do this easily?
What I’m looking for is a formula which takes the size of the array and the index I want and give me the number in [0,1] which corresponds to the texel I want.
I’m writing a shader in GLSL and I need to pass it a certain
Share
perhaps? Just make sure idx and size are floats first.