| Tilt Five NDK |

Functions
Exclusive functions
Tilt Five™ Native Interface (C) » Glasses functions

Functions requiring an exclusive connection. More...

Collaboration diagram for Exclusive functions:

## Functions
T5_EXPORT T5_Result | t5GetGlassesPose (T5_Glasses glasses, T5_GlassesPoseUsage usage, T5_GlassesPose *pose)
| Get the latest pose of the glasses. More...
T5_EXPORT T5_Result | t5InitGlassesGraphicsContext (T5_Glasses glasses, T5_GraphicsApi graphicsApi, void *graphicsContext)
| Initialize the graphics context to enable sending rendered frames to the glasses. More...
T5_EXPORT T5_Result | t5SendFrameToGlasses (T5_Glasses glasses, const T5_FrameInfo *info)
| Send a frame to display on the glasses. More...

## Detailed Description

Functions requiring an exclusive connection.

Exclusive connections are established with t5ReserveGlasses() and t5EnsureGlassesReady().

## Function Documentation

## ◆ t5GetGlassesPose()

T5_EXPORT T5_Result t5GetGlassesPose | ( | T5_Glasses | glasses,
|  | T5_GlassesPoseUsage | usage,
|  | T5_GlassesPose * | pose
| ) |  |

Get the latest pose of the glasses.

Exclusive Connection
  Requires an exclusive connection - established with t5ReserveGlasses() and t5EnsureGlassesReady().

Threading
  Exclusivity group 1 - Functions in this group must not be called concurrently from different threads.

Parameters

  [in] | glasses | - T5_Glasses returned by t5CreateGlasses().
  [in] | usage | - T5_GlassesPoseUsage indicating the intended use for the glasses pose.
  [out] | pose | - T5_GlassesPose representing current glasses pose.

Return values

  T5_SUCCESS | Pose written to `pose`.
  T5_ERROR_INVALID_ARGS | Nullptr was supplied for `pose`.
  T5_ERROR_NO_CONTEXT | `glasses` is invalid.
  T5_ERROR_NOT_CONNECTED | Glasses aren't exclusively connected for this client. Use t5ReserveGlasses() and t5EnsureGlassesReady() first.
  T5_ERROR_TRY_AGAIN | Pose wasn't been received from glasses yet.
  T5_ERROR_INTERNAL | Internal error - not correctable.

Referenced by tiltfive::Glasses::getLatestGlassesPose().

## ◆ t5InitGlassesGraphicsContext()

T5_EXPORT T5_Result t5InitGlassesGraphicsContext | ( | T5_Glasses | glasses,
|  | T5_GraphicsApi | graphicsApi,
|  | void * | graphicsContext
| ) |  |

Initialize the graphics context to enable sending rendered frames to the glasses.

Graphics API
  Clients submit frames for render via texture handles, which vary between graphics engines.

The value of graphicsContext will depend on what library your application is using. Refer to Graphics APIs for more details.

Note that not all values are supported on all platforms (E.g. D3D is only available on Windows).

Threading
  Exclusivity group 3 & Graphic thread only - Functions in this group must not be called concurrently from different threads. The calling thread must be the thread that provided the graphics context.

Parameters

  [in] | glasses | - T5_Glasses returned by t5CreateGlasses().
  [in] | graphicsApi | - T5_GraphicsApi specifying the graphics API for the glasses.
  [in] | graphicsContext | - Meaning depends on the graphics API in use.

Return values

  T5_SUCCESS | The graphics context was successfully initialized.
  T5_ERROR_INVALID_ARGS | graphicsApi was kT5_GraphicsApi_None.
  T5_ERROR_INVALID_STATE | t5InitGlassesGraphicsContext() was previously called on this Glasses object.

Referenced by tiltfive::Glasses::initGraphicsContext().

## ◆ t5SendFrameToGlasses()

T5_EXPORT T5_Result t5SendFrameToGlasses | ( | T5_Glasses | glasses,
|  | const T5_FrameInfo * | info
| ) |  |

Send a frame to display on the glasses.

Both left and right stereoscopic images are presented together via this call. The textures referred to by the `leftTexHandle` and `rightTexHandle` fields of info will be used within this call to enqueue and submit graphics operations that will read the texture data. Once this call returns, no additional operations referencing those textures will be performed. However, depending on the graphics API being used, the application may need to perform additional synchronization prior to freeing the texture resources in order to ensure that the queued graphics operations have completed.

Exclusive Connection
  Requires an exclusive connection - established with t5ReserveGlasses() and t5EnsureGlassesReady().

Graphics Context
  Requires a graphics context - initialized with t5InitGraphicsContext()

Threading
  Exclusivity group 3 & Graphic thread only - Functions in this group must not be called concurrently from different threads. The calling thread must be the thread that provided the graphics context.

See also
  Graphics APIs

Parameters

  [in] | glasses | - T5_Glasses returned by t5CreateGlasses().
  [in] | info | - T5_FrameInfo detailing the frame to display.

Return values

  T5_SUCCESS | The frame was successfully queued to be sent.
  T5_ERROR_INVALID_ARGS | Nullptr was supplied for `info`.
  T5_ERROR_INVALID_STATE | graphicsApi was kT5_GraphicsApi_None when t5CreateGlasses() was called.
  T5_ERROR_NOT_CONNECTED | Glasses aren't exclusively connected for this client. Use t5ReserveGlasses() and t5EnsureGlassesReady() first.
  T5_ERROR_INVALID_GFX_CONTEXT | Graphics context is invalid. Check that graphicsContext was correct when t5InitGraphicsContext() was called.
  T5_ERROR_GFX_CONTEXT_INIT_FAIL | Failed to initialize graphics context. Exact meaning depends on current graphics API.
  T5_ERROR_NO_CONTEXT | `glasses` is invalid.
  T5_ERROR_INTERNAL | Internal error - not correctable.

Referenced by tiltfive::Glasses::sendFrame().