This site has been archived and remains strictly as a historical reference for developers who actively maintain apps built using the legacy Google VR SDK, which was last updated in 2019 and is no longer receiving updates.
  • All developers actively developing experiences for Google Cardboard should use the new open source Cardboard SDKs for iOS, Android NDK, and Unity XR Plugin. These new SDKs offer streamlined APIs, improved device compatibility, and built-in viewer profile QR code scanning.
  • The Daydream View VR headset is no longer available for purchase as of October 15, 2019. Existing apps on supported devices are unaffected for users who previously installed those applications. It is no longer possible to opt-in to Daydream distribution via Google Play.

Viewport

public class Viewport

Defines a viewport rectangle.

Fields

public int height
public int width
public int x
public int y

Public Constructors

Public Methods

boolean
equals(Object obj)
void
getAsArray(int[] array, int offset)
Stores the viewport parameters into an int array.
int
void
setGLScissor()
Sets the current OpenGL scissor rect based on the current viewport settings.
void
setGLViewport()
Sets the current OpenGL viewport based on the current viewport settings.
void
setViewport(int x, int y, int width, int height)
Sets a new viewport based on the provided coordinates and dimensions.
String
toString()
Returns a string containing a concise, human-readable description of this object.

Inherited Methods

Fields

public int height

public int width

public int x

public int y

Public Constructors

public Viewport ()

Public Methods

public boolean equals (Object obj)

Parameters
obj

public void getAsArray (int[] array, int offset)

Stores the viewport parameters into an int array.

Parameters
array Array to store values in.
offset Offset into the array to start writing values in.
Throws
IllegalArgumentException If there is not enough space to write the result.

public int hashCode ()

public void setGLScissor ()

Sets the current OpenGL scissor rect based on the current viewport settings.

public void setGLViewport ()

Sets the current OpenGL viewport based on the current viewport settings.

public void setViewport (int x, int y, int width, int height)

Sets a new viewport based on the provided coordinates and dimensions.

Parameters
x Horizontal pixel coordinate of the bottom-left corner of the viewport.
y Vertical pixel coordinate of the bottom-left corner of the viewport.
width Width of the viewport in pixels.
height Height of the viewport in pixels.

public String toString ()

Returns a string containing a concise, human-readable description of this object.

Returns
  • A printable representation of this object.