hi,
im having problem with my GLSL. so i kept my data in the openGL side by using unsigned char*. its basically an 8 bit data so it will fit the ALPHA8 or GL_RED. i send the data GPU memory by using this:
glTexImage3D(GL_TEXTURE_3D, 0, GL_ALPHA8, textureWidth, textureHeight,
textureDepth, 0, GL_ALPHA, GL_UNSIGNED_BYTE, index3D);
i also has tested using GL_RED instead of GL_ALPHA8. on the GLSL side, i call the value by using this
currIndex = vCurrIndex.a;
or .r if i kept it as RED value. however the data value seems to be halfed. When I check it using this:
if ( currIndex < 0.5) {
color = vec4(1.0, 0.0, 1.0, 1.0); // pink
} else color = vec4(0.0, 1.0, 0.0, 1.0); // green
it all turned up green. but if i put a higher treshold, let say 0.6, there are a few part is pink.
I already check the data before it was sent to the GPU, and its a correct data between 0-255 (converted to unsigned char). Any idea why its halfed? Did i do something wrong back there?
thanks in advance



