November 6, 2019 update:
  • There's a new open source Cardboard SDK for iOS and Android NDK that offers a streamlined API, improved device compatibility, and built-in viewer profile QR code scanning. A corresponding Unity package (SDK) is planned for a future release. We recommend that all developers actively building for Google Cardboard migrate (iOS, Android NDK) to the new Cardboard SDK.
October 15, 2019 update:
  • The Daydream View VR headset is no longer available for purchase. However, you can continue to use the existing Google VR SDK to update and distribute your apps to the Google Play Store, and make them available to users in the Daydream app.

Frame

public class Frame

Single frame acquired from the swap chain. The frame contains one or more buffers that are drawn by the application and are then composited and lens distorted by the SDK.

Public Methods

void
bindBuffer(int bufferIndex)
Binds a pixel buffer that is part of the frame to the OpenGL framebuffer.
void
getBufferSize(int bufferIndex, Point sizeOut)
Returns the dimensions of the pixel buffer with the specified index.
int
getFramebufferObject(int bufferIndex)
Gets the name (ID) of the framebuffer object associated with the specified buffer.
void
submit(BufferViewportList viewportList, float[] headSpaceFromStartSpace)
Submits the frame for lens distortion and display on the screen.
void
unbind()
Unbinds any buffers bound from this frame and binds the default OpenGL framebuffer

Inherited Methods

Public Methods

public void bindBuffer (int bufferIndex)

Binds a pixel buffer that is part of the frame to the OpenGL framebuffer.

Parameters
bufferIndex Index of the GVR buffer to bind.

public void getBufferSize (int bufferIndex, Point sizeOut)

Returns the dimensions of the pixel buffer with the specified index.

Note: A frame that was acquired before resizing a swap chain buffer will not be resized until it is submitted to the swap chain.

Parameters
bufferIndex Index of the pixel buffer to inspect.
sizeOut The (output) dimensions of the specified buffer.

public int getFramebufferObject (int bufferIndex)

Gets the name (ID) of the framebuffer object associated with the specified buffer. The OpenGL state is not modified.

Parameters
bufferIndex Index of the associated GVR buffer.
Returns
  • OpenGL object name (ID) of a framebuffer object which can be used to render into the buffer. The ID is valid only until the frame is submitted.

public void submit (BufferViewportList viewportList, float[] headSpaceFromStartSpace)

Submits the frame for lens distortion and display on the screen.

Note: On Cardboard devices, this method makes OpenGL commands in the current thread's GL context; this can affect various GL state such as texture bindings, depth testing, backface culling, and blending.

Parameters
viewportList List of mappings between regions of buffers in the frame and the viewer's field of view.
headSpaceFromStartSpace the 4x4, column-major transform with which the frame was rendered, representing the transform from start space (space with head at the origin at last tracking reset) to head space (space with head at the origin and axes aligned to the view vector). This should typically be the transform returned by getHeadSpaceFromStartSpaceTransform(float[], long).

public void unbind ()

Unbinds any buffers bound from this frame and binds the default OpenGL framebuffer