GVRCardboardView Class

GVRCardboardView Class Reference

Overview

Defines a view responsible for rendering graphics in VR mode.

It is designed to work in full screen mode with a landscape orientation. It provides all the transition between mono and stereo (VR) modes. The view switches to fullscreen VR mode when vrModeEnabled property is set to YES. The developer should ensure UISupportedInterfaceOrientations key in the application's plist file includes UIInterfaceOrientationPortrait and UIRequiresFullscreen is set to YES.

The users of this class provide an implementation of the GVRCardboardViewDelegate protocol through the delegate property. The methods in the protocol GVRCardboardViewDelegate are called to perform the actual rendering of the graphics.

In order to drive the rendering, the users of this class should call the render method from their render loop. The thread used to call the render method is refered to as the GL thread. This thread, in turn, calls the method of the GVRCardboardViewDelegate protocol.

Inherits UIView.

Instance Method Summary

(instancetype) - initWithFrame:
 Designated initializer. More...
 
(void) - render
 Drives the rendering of the cardboard view. More...
 

Class Method Summary

(void) + setViewerParamsFromUrl:withCompletion:
 Sets the Cardboard viewer parameters from a Url. More...
 

Property Summary

id< GVRCardboardViewDelegatedelegate
 Delegate to be notified of cardboard view rendering. More...
 
EAGLContext * context
 The OpenGL context used for rendering. More...
 
BOOL vrModeEnabled
 The vrModeEnabled property allows switching to and from VR mode. More...
 
BOOL hidesTransitionView
 Flag to hide or show the transition view when in VR mode. More...
 

Method Detail

- (instancetype) initWithFrame: (CGRect)  NS_DESIGNATED_INITIALIZER

Designated initializer.

- (void) render

Drives the rendering of the cardboard view.

Call this from your app's render loop.

+ (void) setViewerParamsFromUrl: (NSURL *)  url
withCompletion: (void(^)(BOOL success, NSError *error))  completion 

Sets the Cardboard viewer parameters from a Url.

This allows programmatically pairing a viewer without having the user go through the pairing flow. Calls the supplied completion handler with the result of pairing and the error if it fails.

Note: The viewer parameters can be set only if no other viewer pairing exists. In other words, this only works if the user hasn't already paired a viewer for the current application.

A valid viewer parameters URI can be generated from this page: https://www.google.com/get/cardboard/viewerprofilegenerator/

Property Detail

- (id<GVRCardboardViewDelegate>) delegate
readwritenonatomicweak

Delegate to be notified of cardboard view rendering.

- (EAGLContext*) context
readwritenonatomicassign

The OpenGL context used for rendering.

Defaults to OpenGL ES3 context, if not set.

- (BOOL) vrModeEnabled
readwritenonatomicassign

The vrModeEnabled property allows switching to and from VR mode.

When set to YES, the cardboard view transitions into a fullscreen view to allow the user to place the device into the Cardboard viewer. When set to NO, it transitions back to pre-VR (mono) mode.

- (BOOL) hidesTransitionView
readwritenonatomicassign

Flag to hide or show the transition view when in VR mode.