I want to encode a data structure in a 3D texture and access in a fragment shader in GLSL. In GLSL, there is no pointer and there is no clean way to access by index. It seems that the only way to access a texture is to send coordinates scalar.
Imagine the simple case of a 1D texture of size N. I want to access the value in box number k of my texture. The case k may for example contain the number of a child or a neighbor in my data structure. It is very important that I get exactly the value stored at this location in the texture and not an interpolated value.
Does texture1D(id, k / (float) N) work? Is that from the data access there is no interpolation or other filtering that could screw up my value?
Bookmarks