c++openvr

OpenVR: Implementation of virtual API functions (GetProjectionMatrix)


I couldn't find the implementation (aka. source) of the pure virtual functions from the openvr header.

I am mainly interested in the GetProjectionMatrix() function.

Where I searched (with no results):

What I found so far: https://github.com/ValveSoftware/openvr/issues/103 , but this seems to deal with problems generated by different compilers. The error of this issue is generated in vrclient.dll provided by SteamVR. There seems to be no public source for both of them.

Any idea, how (/where) these virtual functions are implemented?


Solution

  • You won't like the answer, because the sad reality is that it has no open sources available to us.

    OpenVR is a purely virtual interface library, yes interfaces are open source, but the actual implementations of those interface are not. In case of libopenvr_api (it looks like) those are appended as a binary blob to the interface build.

    The way that works is through factory functions that are declared in the interface library, but defined somewhere else, those externally defined parts are like a black box to us, and unless Valve suddenly change their minds it'll remain that way.

    Those factory functions are declared and used in the OPENVR_INTERFACE_INTERNAL sections of openvr.h and openvr_driver.h (also in case of openvr.h those factory functions are defined in openvr_capi.h, but they use factory functions that are defined in a shared library which is just loaded at runtime and the entire pattern is very similar to the one in openvr.h).

    EDIT:

    (also in case of openvr.h those factory functions are defined in openvr_capi.h, but they use factory functions that are defined in a shared library which is just loaded at runtime and the entire pattern is very similar to the one in openvr.h)

    My memory is clearly failing me, the internal factory functions are defined in openvr_api_public.cpp which is one of the source files libopenvr_api is build from, not in openvr_capi.h (in my defense i didn't look at libopenvr_api sources in a while).