I don't know if it has something to do with OpenGL or it's just Java in general but..

1
| distance = (int) Math.sqrt(((ent.getX() - x) ^ 2) + ((ent.getY() - y) ^ 2)); |

I sometimes get NaN from that.

Although, if I move it around like this..

1
| distance = (int) Math.sqrt(((x - ent.getX()) ^ 2) + ((y - ent.getY()) ^ 2)); |

Instances where it would NaN would return normal numbers, but on the otherhand the instances where it returns a normal number is now NaN.

What did I do wrong? Both X/Y's are on concurrent matrices, so what is it?