toByteArray

Transfers the texture from the GPU to main memory (which is SLOW). The result is a ByteArray of size width * height * 4, and the format is RGBA. i.e. to get the alpha value at x,y :

toByteArray()[ (y * height + x) * 4 + 3 ]

and then deal with the annoyance of java's lack of unsigned bytes. Grr :

.toInt() & 0xFF