Interface VRRenderer


public interface VRRenderer

Application supplied callback that draws the scene for a VRView. Like com.codename1.gpu.Renderer, every method runs on the platform render thread that owns the GPU context - never touch Codename One UI components from these callbacks.

The view clears the frame, sets the per-eye viewport and camera, then invokes #onEyeFrame(GraphicsDevice, VREye, Camera) once per eye (twice per frame in stereo, once with VREye#CENTER in mono). Draw the same scene for every eye; the camera differences produce the stereo effect.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Invoked when the GPU context is being torn down.
    void
    onEyeFrame(GraphicsDevice device, VREye eye, Camera eyeCamera)
    Invoked once per eye per frame to render the scene.
    void
    Invoked once after the GPU context is created.
  • Method Details

    • onInit

      void onInit(GraphicsDevice device)

      Invoked once after the GPU context is created. Allocate buffers, textures and materials here.

      Parameters
      • device: the graphics device bound to this view
    • onEyeFrame

      void onEyeFrame(GraphicsDevice device, VREye eye, Camera eyeCamera)

      Invoked once per eye per frame to render the scene. The viewport and camera are already configured for this eye.

      Parameters
      • device: the graphics device bound to this view

      • eye: which eye is being rendered

      • eyeCamera: the camera for this eye, already applied to the device

    • onDispose

      void onDispose(GraphicsDevice device)

      Invoked when the GPU context is being torn down. Release resources not owned by the device. May be invoked with a null device when the context was lost.

      Parameters
      • device: the graphics device, or null if the context was lost