Skip to main content

Using Warping with Candera

Following are the display properties that required adjustment to use warping with Candera:

  • Enable warping - this should be done before the native handle is available
  • Set warp matrix
  • Set warp image bounds (optional)
  • Apply display settings

Candera::Display class uses a transaction based execution model for setting properties. Several changes can be queued. Changes have to be applied explicitly via a call to Display::ApplyChanges(). Warping matrix data from the warping library can be used directly in Candera.

Execution Overview

Warping is executed in the following steps:

  • Warping mesh creation
  • Rendering of display image to texture
  • Texture mapping of rendered image aperture specified by warp images bounds to the warping mesh

Display content is rendered to a texture. This texture is clipped according to the warp image bounds and the resulting texture is mapped to the warp mesh and rendered in 3D using OpenGL and a very simple shader program.

Mesh and Texture Creation

Upon rendering of a displays content, Candera checks, if:

  • Warping has been en- or disabled
  • Warp matrix has changed
  • Image bounds have changed

If any of these conditions holds, the currently used warping mesh is unloaded. A new warping mesh is computed from the warp matrix as well as the image bounds and uploaded. Vertices in the warp mesh directly map to the corresponding values in the warp matrix. Texture coordinates for vertices are computed from warp mesh vertices as well as warp image bounds. The texture is mapped to the warping mesh and distorted corresponding to the position of the of the warping mesh vertices.