Table of Contents

Class OpenXRApiExtension

Namespace
Godot
Assembly
GodotSharp.dll

OpenXRApiExtension makes OpenXR available for GDExtension. It provides the OpenXR API to GDExtension through the GetInstanceProcAddr(string) method, and the OpenXR instance through GetInstance().

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

[GodotClassName("OpenXRAPIExtension")]
public class OpenXRApiExtension : RefCounted, IDisposable
Inheritance
OpenXRApiExtension
Implements
Inherited Members

Constructors

OpenXRApiExtension()

public OpenXRApiExtension()

Methods

CanRender()

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

public bool CanRender()

Returns

bool

GetErrorString(ulong)

Returns an error string for the given XrResult.

public string GetErrorString(ulong result)

Parameters

result ulong

Returns

string

GetInstance()

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

public ulong GetInstance()

Returns

ulong

GetInstanceProcAddr(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).

public ulong GetInstanceProcAddr(string name)

Parameters

name string

Returns

ulong

GetNextFrameTime()

Returns the timing for the next frame.

public long GetNextFrameTime()

Returns

long

GetPlaySpace()

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

public ulong GetPlaySpace()

Returns

ulong

GetSession()

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

public ulong GetSession()

Returns

ulong

GetSwapchainFormatName(long)

Returns the name of the specified swapchain format.

public string GetSwapchainFormatName(long swapchainFormat)

Parameters

swapchainFormat long

Returns

string

GetSystemId()

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

public ulong GetSystemId()

Returns

ulong

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsInitialized()

Returns true if OpenXR is initialized.

public bool IsInitialized()

Returns

bool

IsRunning()

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

public bool IsRunning()

Returns

bool

OpenxrIsEnabled(bool)

Returns true if OpenXR is enabled.

public static bool OpenxrIsEnabled(bool checkRunInEditor)

Parameters

checkRunInEditor bool

Returns

bool

XRResult(ulong, string, 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.

public bool XRResult(ulong result, string format, Array args)

Parameters

result ulong
format string
args Array

Returns

bool