Distortion Renderer

This module renders the eyes textures into the display.

Summary

Important: This module functions must be called from the render thread.

Functions

CardboardDistortionRenderer_destroy(CardboardDistortionRenderer *renderer)
void
Destroys and releases memory used by the provided distortion renderer object.
CardboardDistortionRenderer_renderEyeToDisplay(CardboardDistortionRenderer *renderer, uint64_t target, int x, int y, int width, int height, const CardboardEyeTextureDescription *left_eye, const CardboardEyeTextureDescription *right_eye)
void
Renders eye textures to a rectangle in the display.
CardboardDistortionRenderer_setMesh(CardboardDistortionRenderer *renderer, const CardboardMesh *mesh, CardboardEye eye)
void
Sets the distortion Mesh for a particular eye.
CardboardMetalDistortionRenderer_create(const CardboardMetalDistortionRendererConfig *config)
Creates a new distortion renderer object.
CardboardOpenGlEs2DistortionRenderer_create()
Creates a new distortion renderer object.
CardboardOpenGlEs3DistortionRenderer_create()
Creates a new distortion renderer object.
CardboardVulkanDistortionRenderer_create()
Creates a new distortion renderer object.

Functions

CardboardDistortionRenderer_destroy

void CardboardDistortionRenderer_destroy(
  CardboardDistortionRenderer *renderer
)

Destroys and releases memory used by the provided distortion renderer object.

Must be called from render thread.

renderer Must not be null. When it is unmet, a call to this function results in a no-op.

Details
Parameters
renderer
Distortion renderer object pointer.

CardboardDistortionRenderer_renderEyeToDisplay

void CardboardDistortionRenderer_renderEyeToDisplay(
  CardboardDistortionRenderer *renderer,
  uint64_t target,
  int x,
  int y,
  int width,
  int height,
  const CardboardEyeTextureDescription *left_eye,
  const CardboardEyeTextureDescription *right_eye
)

Renders eye textures to a rectangle in the display.

Must be called from render thread.

renderer Must not be null. left_eye Must not be null. right_eye Must not be null. When it is unmet, a call to this function results in a no-op.

Details
Parameters
renderer
Distortion renderer object pointer.
target
Target configuration. When using OpenGL ES 2.x and OpenGL ES 3.x, this field corresponds to a GLuint variable. When using Metal, this field corresponds to a variable pointing to an CardboardDistortionRendererTargetConfig structure.
x
x coordinate of the rectangle's lower left corner in pixels.
y
y coordinate of the rectangle's lower left corner in pixels.
width
Size in pixels of the rectangle's width.
height
Size in pixels of the rectangle's height.
left_eye
Left eye texture description.
right_eye
Right eye texture description.

CardboardDistortionRenderer_setMesh

void CardboardDistortionRenderer_setMesh(
  CardboardDistortionRenderer *renderer,
  const CardboardMesh *mesh,
  CardboardEye eye
)

Sets the distortion Mesh for a particular eye.

Must be called from render thread.

renderer Must not be null. mesh Must not be null. When it is unmet, a call to this function results in a no-op.

Details
Parameters
renderer
Distortion renderer object pointer.
mesh
Distortion mesh.
eye
Desired eye.

CardboardMetalDistortionRenderer_create

CardboardDistortionRenderer * CardboardMetalDistortionRenderer_create(
  const CardboardMetalDistortionRendererConfig *config
)

Creates a new distortion renderer object.

It uses Metal as the rendering API. Must be called from the render thread.

Details
Parameters
config
Distortion renderer configuration.
Returns
Distortion renderer object pointer

CardboardOpenGlEs2DistortionRenderer_create

CardboardDistortionRenderer * CardboardOpenGlEs2DistortionRenderer_create()

Creates a new distortion renderer object.

It uses OpenGL ES 2.0 as the rendering API. Must be called from the render thread.

Details
Returns
Distortion renderer object pointer

CardboardOpenGlEs3DistortionRenderer_create

CardboardDistortionRenderer * CardboardOpenGlEs3DistortionRenderer_create()

Creates a new distortion renderer object.

It uses OpenGL ES 3.0 as the rendering API. Must be called from the render thread.

Details
Returns
Distortion renderer object pointer

CardboardVulkanDistortionRenderer_create

CardboardDistortionRenderer * CardboardVulkanDistortionRenderer_create()

Creates a new distortion renderer object.

It uses Vulkan as the rendering API. Must be called from the render thread.

Details
Returns
Distortion renderer object pointer