I am rendering a texture where I am stuck at a point where I need to pick values from some specific index to update the current index.
For EG :
float someColor = texture2D(u_image, vTexCoord).r; //assume u_image is 10*10 image
if (someColor.r > 0.5) {
someColor = someColorPalette[(zr*zcols)+(zc-1)]; //someColorPalette is another texture
//where (zr*zcols)+(zc-1) is getting the pixel value from some index using the calculation
}
`
In the above snippet I know that someColorPalette[(zr*zcols)+(zc-1)]
is a CPU statement and won't work in opengl.
Can anyone suggest for some alternate solution to read from index of a texture?