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:
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?
ah okay im familiar with that, but thats not the problem imo since i do it with other texture and it seems ok.
the data that i sent is pretty normally distributed from 0-255(0-1). when i render the image, it looks like it spread from 128-255(0.5-1.0).
im afraid that this got something to do with me keeping it as an 8 bit values instead of 3x8 bit value. i already test GL_ALPHA(later called index.a) and GL_RED(index.r) but still no luck.