googlevr / gvr-ios-sdk

Google VR SDK for iOS
http://developers.google.com/vr/ios/
Other
645 stars 191 forks source link

GVRVideoView orientation broken #269

Closed jamezilla closed 6 years ago

jamezilla commented 7 years ago

When using the fullscreenVR display mode on GVRVideoView, the UI elements (ie. nav, gear, divider) display properly but the GL stereo view isn't rotated properly, relative to the device orientation.

image

Screenshot is an iPad mini, but I checked this on an iPhone as well with the same results.

Versions:

PODS:
  - GoogleToolboxForMac/Defines (2.1.0)
  - GoogleToolboxForMac/Logger (2.1.0):
    - GoogleToolboxForMac/Defines (= 2.1.0)
  - GTMSessionFetcher/Core (1.1.6)
  - GVRSDK (1.80.0):
    - GoogleToolboxForMac/Logger (= 2.1.0)
    - GTMSessionFetcher/Core (= 1.1.6)

Also broken in 1.70

Repro project here: https://github.com/jamezilla/SimpleVR

sanjayc77 commented 7 years ago

iPad is not supported for VR (stereoscopic) rendering. You can only use it for monoscopic rendering. I am not aware of any Cardboard viewer that can hold an iPad, not is it supported.

jamezilla commented 7 years ago

@sanjayc77 You apparently missed this detail in my bug report:

I checked this on an iPhone as well with the same results.

I can appreciate that you're trying to triage and close things quickly, but this is a legit bug.

sanjayc77 commented 7 years ago

You are right, I did miss the iPhone bit. Sorry about that. Investigating...

sanjayc77 commented 7 years ago

I am getting linker errors on SimpleVR project, after running pod update:

ld: warning: directory not found for option '-L/Users/sanjayc/Library/Developer/Xcode/DerivedData/SimpleVR-dvknadxczlikjafjfroyhsuhtjzd/Build/Products/Debug-iphoneos/GTMSessionFetcher' ld: warning: directory not found for option '-L/Users/sanjayc/Library/Developer/Xcode/DerivedData/SimpleVR-dvknadxczlikjafjfroyhsuhtjzd/Build/Products/Debug-iphoneos/GoogleToolboxForMac' ld: library not found for -lGTMSessionFetcher clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am using Xcode 9 beta 6

jacobfnl commented 6 years ago

Definitely broken for iOS 11. iOS 10.3.3 is fine. In my tests, it orients fine for the first launch of the GVRVideoView. However, successive launches may randomly orient incorrectly.

fredsa commented 6 years ago

I was able to reproduce the orientation problem using Xcode 9.0 (9A235) on an iPhone 6s running iOS 11.0:

# Clone at commit 51a3a1208413ce0bdf8a6bda4e3bf957eab0d302
git clone https://github.com/jamezilla/SimpleVR
cd SimpleVR/
pod update

screen shot 2017-09-29 at 12 34 31 pm

sanjayc77 commented 6 years ago

Commenting out NSLayoutConstraint.activate code fixes it:

/NSLayoutConstraint.activate([ videoView.topAnchor.constraint(equalTo: view.topAnchor), videoView.trailingAnchor.constraint(equalTo: view.trailingAnchor), videoView.bottomAnchor.constraint(equalTo: view.bottomAnchor), videoView.leadingAnchor.constraint(equalTo: view.leadingAnchor) ])/

The implementation of fullscreen VR is done in a separate UIWindow. Whereas you are trying to layout the video view fullscreen using NSLayoutConstraint and also set VR mode. VRViews were designed to be embedded or shown fullscreen mono and fullscreen stereo(VR). The last two modes use a separate UIWindow.

It is possible to show fullscreen mono using the embed mode (using layout constraint), but then it would not handle VR.

VRView widgets are deprecated. You should switch to GVRKit, released as sample code: https://github.com/googlevr/gvr-ios-sdk/tree/master/Samples/GVRKit

Also take a look at the update video widget sample on how to use GVRKit.