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.
Methods
public abstract void onInit(GraphicsDevice device) | Invoked once after the GPU context is created. |
public abstract void onEyeFrame(GraphicsDevice device, VREye eye, Camera eyeCamera) | Invoked once per eye per frame to render the scene. |
public abstract void onDispose(GraphicsDevice device) | Invoked when the GPU context is being torn down. |
Method details
onInit
public abstract void onInit(GraphicsDevice device)Invoked once after the GPU context is created. Allocate buffers,
textures and materials here.
Parameters
deviceGraphicsDevice- the graphics device bound to this view
onEyeFrame
public abstract 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
deviceGraphicsDevice- the graphics device bound to this view
eyeVREye- which eye is being rendered
eyeCameraCamera- the camera for this eye, already applied to the device
onDispose
public abstract 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
deviceGraphicsDevice- the graphics device, or null if the context was lost