Since glsl runs into some rather funky compilation problems(using cg compiler) when large arrays are being used(2565ivec3), I decided to put one of my lookup tables for a project on a texture. At first I thought it was so simple as to make java write the values of each vector to the red, green and blue channels respectivly of some image, and then sample this image(image quite naturally generated beforehand, no mystic vodoo message passing between C++ and Java) with coordinates derived from my case value(the case i was to look up in the table), while also mutiplying the values with 255(since they are normalized when sampled with texture(samplerXD, coords)).
Did not work.
So i searcher around for a bit and found out about texelFetch, and tried to fetch the texel in particular, did not work either. At this point, I started to wonder if i were to naive to expect to be able to restore the values from the image(in between i tried to change the sampler for the texture from sampler2d to i sampler2d, not supposed to work?), so I searched around for some kind of alternative, and found out about Integer textures(now we are on openGL grounds, but this post seem more related to GLSL anyways): http://www.opengl.org/wiki/GL_EXT_texture_integer, which seemed really nifty, but I had a real hard time finding out more about how they were used.
Basically my question boils down to two points:
1, Should I generate some image beforehand(png, jpeg, targa whatever) with the values I am after and sample from those images in some way(please tell me how then because after all my experimentations i am clueless and also pretty pissed at GLSL for, as it appear to me at least, not sampling the right texel with fetchTexel).
2, Should i use Integer textures and create some kind of struct or something with the proper data using my lookup table textfile? And if so, some pointer to as how this would be done would be appreciated.
If that has any impact on the answer I would also like to add that my values are only going to range between 0-12.
Super thanks for your mega time
Deyy tuuk ur djeeebs!