Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

OpenXRAPIExtension

Inherits: RefCounted < Object

Makes the OpenXR API available for GDExtension.

Description

OpenXRAPIExtension makes OpenXR available for GDExtension. It provides the OpenXR API to GDExtension through the get_instance_proc_addr method, and the OpenXR instance through get_instance.

It also provides methods for querying the status of OpenXR initialization, and helper methods for ease of use of the API with GDExtension.

Tutorials

Methods

bool

can_render()

String

get_error_string(result: int)

int

get_hand_tracker(hand_index: int)

int

get_instance()

int

get_instance_proc_addr(name: String)

int

get_next_frame_time()

int

get_play_space()

int

get_session()

String

get_swapchain_format_name(swapchain_format: int)

int

get_system_id()

OpenXRAlphaBlendModeSupport

is_environment_blend_mode_alpha_supported()

bool

is_initialized()

bool

is_running()

bool

openxr_is_enabled(check_run_in_editor: bool) static

void

register_composition_layer_provider(extension: OpenXRExtensionWrapperExtension)

void

set_emulate_environment_blend_mode_alpha_blend(enabled: bool)

Transform3D

transform_from_pose(pose: const void*)

void

unregister_composition_layer_provider(extension: OpenXRExtensionWrapperExtension)

bool

xr_result(result: int, format: String, args: Array)


Enumerations

enum OpenXRAlphaBlendModeSupport:

OpenXRAlphaBlendModeSupport OPENXR_ALPHA_BLEND_MODE_SUPPORT_NONE = 0

Means that XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND isn't supported at all.

OpenXRAlphaBlendModeSupport OPENXR_ALPHA_BLEND_MODE_SUPPORT_REAL = 1

Means that XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND is really supported.

OpenXRAlphaBlendModeSupport OPENXR_ALPHA_BLEND_MODE_SUPPORT_EMULATING = 2

Means that XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND is emulated.


Method Descriptions

bool can_render()

Returns true if OpenXR is initialized for rendering with an XR viewport.


String get_error_string(result: int)

Returns an error string for the given XrResult.


int get_hand_tracker(hand_index: int)

Returns the corresponding XRHandTrackerEXT handle for the given hand index value.


int get_instance()

Returns the XrInstance created during the initialization of the OpenXR API.


int get_instance_proc_addr(name: String)

Returns the function pointer of the OpenXR function with the specified name, cast to an integer. If the function with the given name does not exist, the method returns 0.

Note: openxr/util.h contains utility macros for acquiring OpenXR functions, e.g. GDEXTENSION_INIT_XR_FUNC_V(xrCreateAction).


int get_next_frame_time()

Returns the timing for the next frame.


int get_play_space()

Returns the play space, which is an XrSpace cast to an integer.


int get_session()

Returns the OpenXR session, which is an XrSession cast to an integer.


String get_swapchain_format_name(swapchain_format: int)

Returns the name of the specified swapchain format.


int get_system_id()

Returns the id of the system, which is a XrSystemId cast to an integer.


OpenXRAlphaBlendModeSupport is_environment_blend_mode_alpha_supported()

Returns OpenXRAlphaBlendModeSupport denoting if XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND is really supported, emulated or not supported at all.


bool is_initialized()

Returns true if OpenXR is initialized.


bool is_running()

Returns true if OpenXR is running (xrBeginSession was successfully called and the swapchains were created).


bool openxr_is_enabled(check_run_in_editor: bool) static

Returns true if OpenXR is enabled.


void register_composition_layer_provider(extension: OpenXRExtensionWrapperExtension)

Registers the given extension as a composition layer provider.


void set_emulate_environment_blend_mode_alpha_blend(enabled: bool)

If set to true, an OpenXR extension is loaded which is capable of emulating the XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND blend mode.


Transform3D transform_from_pose(pose: const void*)

Creates a Transform3D from an XrPosef.


void unregister_composition_layer_provider(extension: OpenXRExtensionWrapperExtension)

Unregisters the given extension as a composition layer provider.


bool xr_result(result: int, format: String, args: Array)

Returns true if the provided XrResult (cast to an integer) is successful. Otherwise returns false and prints the XrResult converted to a string, with the specified additional information.


User-contributed notes

Please read the User-contributed notes policy before submitting a comment.