Dealing with 16 bit value

hi,

im having trouble trying to send a 16bit data as a texture to glsl. so i have an array of short value that i want to send as texture. i sent the value from the program like this:

glTexImage3D(GL_TEXTURE_3D, 0, GL_R16I, textureWidth, textureHeight, textureDepth, 0, GL_RED, GL_RED_INTEGER, indexFit);

and inside the GLSL i put this on the top:

uniform isampler3D texIndex;

i grab the data by doing texelfetch like this:

int currIndex = int(texelFetch(texIndex, currIvec, 0).r);

i use int since glsl dont recognize short(right?).now the value that i got on the scene is wrong. i dont know what type of data that i get but i cant do this comparison:

if(currIndex > 1)

it always return false (the data is checked and rechecked to be more than 1). how can i retrieve a texture with 16 bit data? how can i use it in glsl code?

thanks in advance

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.