googlevr / gvr-ios-sdk

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

resolution of GVRCardboardView? #315

Closed bsabiston closed 6 years ago

bsabiston commented 6 years ago

I'm trying to use this SDK with my Metal app, by intercepting the calls to the OpenGL renderer and converting them to Metal matrices. I notice that the viewport calls set up left and right views with a resolution of 896x1039. Is that the same no matter what phone is used? My iPhone 7 is 1334 x 750, so it must be scaling that view down to fit the phone, is that correct? Is it just assuming some default resolution for rendering? I don't think the source is available for the code that sets up the viewControllers. In fact, by debugging the view hierarchy, it looks like the SDK actually sets up an entirely different window on iOS when you create a CardboardView. I am just setting that to hidden, which still causes the render delegate to function so that I can retrieve the matrices.

jdduke commented 6 years ago

The resolution depends both on the headset being used as well as the phone DPI/resolution. Keep in mind that the render target the app draws into (and provided by the SDK) is not the same as the one that the SDK ultimately uses to output the distorted frame.