WVR Overlay¶
Overlay provides a way to draw 2D images over 3D scenes. These methods allow the developers to controll the overlays’ appearance, behaviors and events.
Tutorial¶
- Include libwvr_api.so and the overlay header file “wvr/wvr_overlay.h”.
- After executing WVR_RenderInit(), get the overlay ID through WVR_GenOverlay().
After WVR_RenderInit()
WVR_GenOverlay(&overlayId);
overlayEventCallback.overlayId = overlayId;
- Assign the event handle method, and register the overlay event callback.
overlayEventCallback.callback = handleInputEvent;
WVR_RegisterOverlayInputEvent(&overlayEventCallback);
void handleInputEvent(int32_t id, HVR_EventType type, HVR_InputId inputId) {
.... // Perform action
}
- Generate the texture, and assign the texture ID to the overlay.
WVR_SetOverlayTextureId(overlayId, &texture);
- Set the overlay position.
const WVR_OverlayPosition position = {0.0f, 0.0f, -1.0f};
WVR_SetOverlayFixedPosition(overlayId, &position);