Git Product home page Git Product logo

osgxr's Introduction

osgXR: Virtual Reality with OpenXR and OpenSceneGraph

This library is to allow Virtual Reality support to be added to OpenSceneGraph applications, using the OpenXR standard.

Status:

  • Still in development, contributions welcome. Plenty of work to do.
  • APIs to support OpenXR VR display output in OpenSceneGraph apps.
  • APIs to support OpenXR's action based input and haptic output for controller interaction.
  • OpenGL graphics bindings for Linux (X11/Xlib) and Windows (note that WMR only supports DirectX bindings).

License: LGPL 2.1

Dependencies: OpenSceneGraph, OpenXR

Links:

Installation

Something like this:

mkdir build
cd build
cmake ..
make
make install

Getting Started

To import osgXR into a CMake based project, you can use the included CMake module, adding something like this to your CMakeLists.txt:

find_package(osgXR 0.5.0 REQUIRED)

target_link_libraries(target
        ..
        osgXR::osgXR
)

osgXR can also optionally be built as a subproject. Consider using git subtree to import osgXR, then use something like this:

add_subdirectory(osgXR)

target_link_libraries(target
        ..
        osgXR
)

If you have installed osgXR outside of the system prefix (CMake's default prefix on UNIX systems is /usr/local), you may need to tell CMake where to find it when you configure the project. You can do this by defining osgXR_DIR when invoking cmake, e.g. with the argument -DosgXR_DIR=$PREFIX/lib/cmake/osgXR where $PREFIX is osgXR's install prefix (CMAKE_INSTALL_PREFIX).

The Public API

See the API documentation for details of the API.

osgxr's People

Contributors

amalon avatar vezza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

simoom2000 vezza

osgxr's Issues

Timing Issues with high latency wireless headset (Quest 3 via SteamLink)

Thanks for your work and effort to create this lib.

I am currently working on a project where I want to display an osg graph in a VR headset (Quest 3) via wifi streaming (steam link, win11 with msys2, mingw64).

Due to your easy setup, I had a quick success seeing something.

But I noticed flickering of the image in the headset, along with this repeated error messages:

Failed to acquire swapchain image: XR_ERROR_CALL_ORDER_INVALID
XRView::preDrawCallback(): Failure to acquire OpenXR swapchain image (got image index -1)
Failed to begin OpenXR frame: XR_ERROR_CALL_ORDER_INVALID
Failed to begin OpenXR frame: XR_ERROR_CALL_ORDER_INVALID
Failed to begin OpenXR frame: XR_ERROR_CALL_ORDER_INVALID
Failed to begin OpenXR frame: XR_ERROR_CALL_ORDER_INVALID
Failed to acquire swapchain image: XR_ERROR_CALL_ORDER_INVALID
XRView::preDrawCallback(): Failure to acquire OpenXR swapchain image (got image index -1)

I suspect the issues are created by the higher latencies introduced by the wifi image transmission.

While trying to fix it myself, I found this PR on the Godot game engine that seems to be related:
godotengine/godot#82752, the linked issue there also describes using a Quest headset that results in XR_ERROR_CALL_ORDER_INVALID messages.

In the PR discussion, they explain that the result of xrAcquireSwapchainImage may be > 0, which also defines an erorr state, but that is not handled by XR_FAILED() but by XR_UNQUALIFIED_SUCCESS().

The check() function in Instance.cpp, only checks for XR_FAILED(), not for XR_UNQUALIFIED_SUCCESS() (https://github.com/amalon/osgXR/blob/master/src/OpenXR/Instance.cpp#L302)

I tried to implement a fix, but I failed in finding the correct spots (e.g. a good way) for not calling xrEndFrame in the wrong situation, as described here.

Just increasing the timeout in Swapchain::waitImage does not help.

Any help is appreciated (either a fix or some hints that help me to provide a PR).

Thanks in advance.

XR_ERROR_RUNTIME_UNAVAILABLE requires some minimal version for openxr?

Hi there,
just a comment, my system has only openxr-1.0.13 and the build of osgXR-0.5.1 fails with it. I indeed cannot find the variable in openxr.h, but I do see it in latest versions of openxr.
Maybe some conditionals on a minimal version of openxr should be added in cmake config files, or, some preprocessor conditionals in the code itself to not use that guy for older version of openxr?

PS: tested also osgXR-0.5.1 against openxr-1.0.22, everything is fine there!

Cheers,
Chris.

Error messages in flightgear-2020.4.0

I do not have yet VR headset, but I have been building and running flightgear-2020.4.0 with osgXR enabled. This shows up in the console at start-up:

Now checking for plug-in osgPlugins-3.6.5/osgdb_nvtt.so
Error [GENERAL |  | OpenXR-Loader] : RuntimeManifestFile::FindManifestFiles - failed to determine active runtime file path for this environment
Error [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : RuntimeInterface::LoadRuntimes - unknown error
Error [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : RuntimeInterface::LoadRuntimes - failed to find a valid runtime
Error [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : Failed to find default runtime with RuntimeInterface::LoadRuntime()
Error [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : Failed querying extension properties
Error [GENERAL |  | OpenXR-Loader] : RuntimeManifestFile::FindManifestFiles - failed to determine active runtime file path for this environment
Error [    0.43 [INFO]:OSG
GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : RuntimeInterface::LoadRuntimes - unknown error
Error [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : RuntimeInterface::LoadRuntimes - failed to find a valid runtime
Error [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : Failed to find default runtime with RuntimeInterface::LoadRuntime()
Error [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader    0.43 [WARN]:OSG        Failed to count OpenXR instance extensions: -13
] : Failed querying extension properties

Let me know if you prefer this bug to be opened as a flightgear's ticket!
Cheers,
Chris.

How do actions work ?

I am having some problems to implement a osgXR action https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XR_EXT_eye_gaze_interaction
I could not understand how I am supposed to go about implementing it, I tried something like:

actionSet = new osgXR::ActionSet(manager, "user_intent", "User Intent");
actionPose = new osgXR::ActionPose(actionSet, "gaze_pose", "Gaze pose");
interactionProfile = new osgXR::InteractionProfile(manager, "ext", "eye_gaze_interaction");
subAction = new osgXR::Subaction(manager, "/user/eyes_ext/input/gaze_ext/pose");

actionPose->addSubaction(subAction);
interactionProfile ->suggestBinding(actionPose, "/user/eyes_ext/input/gaze_ext/pose");
actionSet->activate(subAction);

syncActionSetup();
actionSet->activate(subAction);
manager->syncSettings()
manager->update()

and then tried to get the location with:

osgXR::ActionPose::Location location = action->getValue(subAction);

however, the location is always empty.

I also made a minor change to the osgXR code to enable the XR_EXT_eye_gaze_interaction extension that is needed for this action as I couldn't find a way to enable extensions without doing so.

What am I missing ?

building failures

Hi there,
I was trying to build the lib with cmake, but it fails searching for some funny target Threads (OpenThreads is properly found).
cmake version 3.19.2

Any help welcome.

Thanks,
Cheers,
Chris.

The C compiler identification is GNU 10.3.0
-- The CXX compiler identification is GNU 10.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenGL: /usr/lib64/libOpenGL.so
-- Found osgViewer: /usr/lib64/libosgViewer.so
-- Found osgUtil: /usr/lib64/libosgUtil.so
-- Found osg: /usr/lib64/libosg.so
-- Found OpenThreads: /usr/lib64/libOpenThreads.so
-- Found OpenSceneGraph: /usr/lib64/libosgViewer.so;/usr/lib64/libosgUtil.so;/usr/lib64/libosg.so;/usr/lib64/libOpenThreads.so (found version "3.6.5")
-- Found X11: /usr/include
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Configuring done
CMake Error at src/CMakeLists.txt:74 (add_library):
  Target "osgXR" links to target "Threads::Threads" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

pkgconfig name

Hi there,
just spotted a little issue when building against OpenXR 1.0.22, the pkgconfig provides seems to be openxr instead of OpenXR. I've fixed it with this:

--- osgXR-0.3.8/osgXR.pc.in.orig        2022-04-10 17:48:35.661919444 +0200
+++ osgXR-0.3.8/osgXR.pc.in     2022-04-10 17:48:53.002573686 +0200
@@ -7,6 +7,6 @@
 Description: @PROJECT_DESCRIPTION@
 Version: @PROJECT_VERSION@

-Requires: openscenegraph OpenXR
+Requires: openscenegraph openxr
 Libs: -L${libdir} -lmylib
 Cflags: -I${includedir}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.