A monotonic system time representation. On Android, this is equivalent to
System.nanoTime(), or clock_gettime(CLOCK_MONOTONIC). If there is any doubt
about how to get the current time for the current platform, simply use
gvr_get_time_point_now().
A floating point quaternion, in JPL format.
We use this simple struct in order not to impose a dependency on a
particular math library. The user of this API is free to encapsulate this
into any math library they want.
A floating point 2D rect. Used for field of view, and also for ranges
in texture space. When used for a field of view, all angles are in positive
degrees from the optical axis.
Sets the color format for the buffer to be created. Default format is
GVR_COLOR_FORMAT_RGBA_8888. For all alpha-containing formats, the pixels
are expected to be premultiplied with alpha. In other words, the 60% opaque
primary green color is (0.0, 0.6, 0.0, 0.6).
Sets the depth and stencil format for the buffer to be created. Currently,
only packed stencil formats are supported. Default format is
GVR_DEPTH_STENCIL_FORMAT_DEPTH_16.
Sets the ID of the externally-managed Surface texture from which this
viewport reads. The ID is issued by GvrLayout. If this viewport does not
read from an external surface, this should be set to
GVR_EXTERNAL_SURFACE_ID_NONE, which is also the default value. If it does
read from an external surface, set this to the ID obtained from GvrLayout
and set the source buffer index to the special value
GVR_BUFFER_INDEX_EXTERNAL_SURFACE.
Sets the type of reprojection to perform on the specified viewport.
Viewports that display world content should use full reprojection.
Viewports that display head-locked UI should disable reprojection to avoid
excessive judder. The default is to perform full reprojection.
Computes the distorted point for a given point in a given eye. The
distortion inverts the optical distortion caused by the lens for the eye.
Due to chromatic aberration, the distortion is different for each
color channel.
Sets up arm model with user’s handedness, gaze behavior and head rotation.
This setting needs to be applied for every frame. User preferences of
handedness and gaze behavior can be changed as needed in a sequence of
frames. This needs to be called before gvr_controller_state_update() to
apply arm model. GVR_CONTROLLER_ENABLE_ARM_MODEL flag needs to be enabled
to apply arm model. The controller position computed with arm model is
relative to the head origin. If using the opt-in neck model, the effective
eye position after using vr_apply_neck_model() is shifted forward from the
head origin by the neck-to-eye distance (8cm) when the head is in
neutral position, and a matching forward offset should be applied to the
controller position to compensate.
Creates and initializes a gvr_controller_context instance which can be used
to invoke the Daydream Controller API functions. Important: after creation
the API will be in the paused state (the controller will be inactive).
You must call gvr_controller_resume() explicitly (typically, in your Android
app’s onResume() callback).
Pauses the controller, possibly releasing resources.
Call this when your app/game loses focus.
Calling this when already paused is a no-op.
Thread-safe (call from any thread).
Returns whether the controller battery is currently charging.
This may not be real time information and may be slow to be updated.
The last battery update time is available by calling
gvr_controller_state_get_battery_timestamp.
Returns the bucketed controller battery level at the last update.
Note this is a gvr_controller_battery_level and not a percent.
The last battery update time is available by calling
gvr_controller_state_get_battery_timestamp.
Gets the connection state of the controller. Returns one of the
gvr_controller_connection_state variants, but returned as an int32_t for ABI
compatibility.
Returns the current controller orientation, in Start Space. The Start Space
is the same space as the headset space and has these three axes
(right-handed):
Returns true if a recenter operation just ended. This is a transient event:
(i.e., it is true only for one frame after the recenter ended). If this is
true then the orientation field is already relative to the new center.
If the user is touching the touchpad, this returns the touch position in
normalized coordinates, where (0,0) is the top-left of the touchpad
and (1,1) is the bottom right. If the user is not touching the touchpad,
then this is the position of the last touch.
Updates the controller state. Reading the controller state is not a
const getter: it has side-effects. In particular, some of the
gvr_controller_state fields (the ones documented as “transient”) represent
one-time events and will be true for only one read operation, and false
in subsequent reads.
Destroys a gvr_context instance. The parameter will be nulled by this
operation. Once this function is called, the behavior of any subsequent
call to a GVR SDK function that references objects created from this
context is undefined.
@deprecated Use the Swap Chain API instead. This function exists only to
support legacy rendering pathways for Cardboard devices. It is
incompatible with the low-latency experiences supported by async
reprojection.
Returns the dimensions of the pixel buffer with the specified index. Note
that a frame that was acquired before resizing a swap chain buffer will not
be resized until it is submitted to the swap chain.
@deprecated Calls to this method can be safely replaced by calls to
gvr_get_head_space_from_start_space_transform. The new API reflects that
the call can return a full 6DoF transform when supported by both the
host platform and the client application.
Returns the maximum effective size for the client’s render target, given the
parameters of the head mounted device selected. At this resolution, we have
a 1:1 ratio between source pixels and screen pixels in the most magnified
region of the screen. Applications should rarely, if ever, need to render
to a larger target, as it will simply result in sampling artifacts.
Gets the recommended buffer viewport configuration, populating a previously
allocated gvr_buffer_viewport_list object. The updated values include the
per-eye recommended viewport and field of view for the target.
Gets the screen (non-distorted) buffer viewport configuration, populating a
previously allocated gvr_buffer_viewport_list object. The updated values
include the per-eye recommended viewport and field of view for the target.
Initializes necessary GL-related objects and uses the current thread and
GL context for rendering. Please make sure that a valid GL context is
available when this function is called.
@deprecated Calls to this method can be safely replaced by calls to
gvr_recenter_tracking. This accomplishes the same effects but avoids the
undesirable side-effects of a full reset (temporary loss of tracking
quality).
Sets the default viewer profile specified by viewer_profile_uri.
The viewer_profile_uri that is passed in will be ignored if a valid
viewer profile has already been stored on the device that the app
is running on.
Acquires a frame from the swap chain for rendering. Buffers that are part of
the frame can then be bound with gvr_frame_bind_buffer(). Once the frame
is finished and all its constituent buffers are ready, call
gvr_frame_submit() to display it while applying lens distortion.
Creates a swap chain from the given buffer specifications.
This is a potentially time-consuming operation. All frames within the
swapchain will be allocated. Once rendering is stopped, call
gvr_swap_chain_destroy() to free GPU resources. The passed gvr_context must
not be destroyed until then.
Retrieves the size of the specified pixel buffer. Note that if the buffer
was resized while the current frame was acquired, the return value will be
different than the value obtained from the equivalent function for the
current frame.
Resizes the specified pixel buffer to the given size. The frames are resized
when they are unused, so the currently acquired frame will not be resized
immediately.
Specification of a pixel buffer. A pixel buffer can have color, depth and
stencil attachments and mostly corresponds to the OpenGL concept of a
framebuffer object. However, since there can be multiple such objects for
each frame, we avoid calling them “framebuffers”. Pixel buffers which are
part of the currently acquired frame are immutable, i.e., they cannot be
resized or otherwise reconfigured.
A structure that ties together a region of a buffer, the field of view
rendered into that region and a target eye index to define part of the
user’s field of view. The SDK implementation uses this information to
transform the images generated by the app output into the final display that
is sent to the screen.
A single frame acquired from the swap chain. Each frame is composed of one
or more buffers, which are then lens distorted and composited into the final
output. Buffers are identified by indices that correspond to the position
of their gvr_buffer_spec in the list passed when constructing the swap
chain.
Swap chain that contains some number of frames. Frames in the swap chain
can be unused, in the process of being distorted and presented on the
screen, or acquired and being rendered to by the application. The swap chain
ensures that the most recent available frame is always shown and that the
application never has to wait to render the next frame.