Hi all.
I am currently using a lookup table to make some integral go faster in my application. To do this I load up a .csv file containing floating point values and then attempt to create a floating point texture using that like so.
int numCSVs = 0;
float* texData = harvesterPtr->loadCSV("tableF.csv", numCSVs);
int texDim = sqrt(float(numCSVs));
glGenTextures(1, &textureF);
glBindTexture(GL_TEXTURE_2D, textureF);
glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, texDim, texDim, 0, GL_RED, GL_FLOAT, texData);
The CSV contains a block of 512 * 512 values and on inspection “texData” contains the right values in a single array sized 262144. Moreover, texDim evaluates to 512 as expected.
In my shader this texture is declared as:
uniform sampler2D textureF;
and to set it in my application I use
glUseProgram(direct);
glUniform1i(glGetUniformLocation(direct, "textureF"), 4);
during the draw loop I have
glActiveTexture(GL_TEXTURE4);
glBindTexture(GL_TEXTURE_2D, textureF);
When I simply output texture vals using
radiance.rgb = vec3(texture(textureF, texCoords).s, texture(textureF, texCoords).s, texture(textureF, texCoords).s);
While drawing a full screen quad, it seems to just read 0 values. Other textures are displayed just fine.
Am I forgetting something glaringly obvious? The csv table values aren’t clamped to 0 to 1, would this have something to do with it?
Help would be greatly appreciated