Fixed bug that prevent zbuffer from being created in some orientations.
Improvements to device orientation when using an offscreen render target.