added a check to see if glViewController is part of the appDelegate to prevent possible crashes.
Merge pull request #2413 from julapy/ios-orientation-tweak

ios orientation tweak