View Full Version : dealing with 16 bit value

11-21-2010, 12:53 PM

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