Added some adapted code

RedSquare from the JOGL unit tests and DistortionCorrection from
https://developer.oculusvr.com/forums/viewtopic.php?f=20&t=88&start=#p977