Wonwoo Lee
06-06-2011, 04:40 PM
Hello.
I have two arrays of 'unsigned char' data, and I'd like to do bitwise AND operations between them.
If I have arrays of A and B, what I have to do is something like this:
C[i] = A[i] & B[i] ;
Because the arrays are very large and the platform I'm working is a smartphone, I am trying to do the job in GLSL ES.
Here, I encountered two problems.
1. The texture values retrieved from texture2D(.) are given in float type, instead of 'unsigned char', which I want to use. Is there a way to use the unsigned char data as it is in GLSL ES shader ?
2. There is no bitwise AND operation in GLSL ES, as I'm aware. How could I do 'AND' ? Should I implement a function that mimics 'AND' manually ?
I have two arrays of 'unsigned char' data, and I'd like to do bitwise AND operations between them.
If I have arrays of A and B, what I have to do is something like this:
C[i] = A[i] & B[i] ;
Because the arrays are very large and the platform I'm working is a smartphone, I am trying to do the job in GLSL ES.
Here, I encountered two problems.
1. The texture values retrieved from texture2D(.) are given in float type, instead of 'unsigned char', which I want to use. Is there a way to use the unsigned char data as it is in GLSL ES shader ?
2. There is no bitwise AND operation in GLSL ES, as I'm aware. How could I do 'AND' ? Should I implement a function that mimics 'AND' manually ?