MerjTek.MonoGame.OpenVr.OpenGL 1.0.1

dotnet add package MerjTek.MonoGame.OpenVr.OpenGL --version 1.0.1                
NuGet\Install-Package MerjTek.MonoGame.OpenVr.OpenGL -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MerjTek.MonoGame.OpenVr.OpenGL" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MerjTek.MonoGame.OpenVr.OpenGL --version 1.0.1                
#r "nuget: MerjTek.MonoGame.OpenVr.OpenGL, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MerjTek.MonoGame.OpenVr.OpenGL as a Cake Addin
#addin nuget:?package=MerjTek.MonoGame.OpenVr.OpenGL&version=1.0.1

// Install MerjTek.MonoGame.OpenVr.OpenGL as a Cake Tool
#tool nuget:?package=MerjTek.MonoGame.OpenVr.OpenGL&version=1.0.1                

MerjTek.MonoGame.OpenVr

MerjTek.MonoGame.OpenVr is a library that works on WIndows to add OpenVR (SteamVR) abilities to a MonoGame project.

Help Needed

  • Fill in the different hardware OVRControllerProfiles for each VR device. This is the rAxis and ulButtonPressed information for each device.
    • Can those with various VR Hardware possibly help?
  • Finish getting the correct position and rotation information for the OVRController.

Nuget Packages

- MerjTek.MonoGame.OpenVr.DirectX v1.0.1
- MerjTek.MonoGame.OpenVr.OpenGL v1.0.1

How To Use

After Installing the Nuget Package:

    ...
    // In Game1.cs add the using statement below:
    using MerjTek.MonoGame.OpenVr;
    ...


    ...
    public Game1()
    {
        _graphics = new GraphicsDeviceManager(this);

        // DirectX must use the HiDef profile. OpenGL can use both profiles.
        _graphics.GraphicsProfile = GraphicsProfile.HiDef; 
    ...


    ...
    // Change the Game1 base class definiton:

    // Original (From)
    public class Game1 : Game

    // Updated (To)
    public class Game1 : VrGame
    ...


    ...
    // In the Draw method
    protected override void Draw(GameTime gameTime)
    {
        // Drawing code here
        
        // NOTE: The NearPlane, FarPlane, and ViewMatrix properties must be  
        // set anywhere before base.Draw is called.

        base.Draw(gameTime);
        
        // OPTIONAL: Render the left eye to the screen
        _spriteBatch.Begin();
        _spriteBatch.Draw(LeftEyeTarget, Vector2.Zero, Color.White);
        _spriteBatch.End();
    }
    ...


    ...
    // Add and implement DrawScene:

    /// <summary>
    /// Renders the scene for one eye. Will be called twice.
    /// </summary>
    /// <param name="eyeView">The view matrix adjusted per eye. (DO NOT MODIFY)</param>
    /// <param name="eyeProjection">The projection matrix adjusted per eye. (DO NOT MODIFY)</param>
    protected override void DrawScene(Matrix eyeView, Matrix eyeProjection)
    {
        // NOTE: Implement scene drawing code here
    }
    ...

Caveats

  • Make sure you are using the HiDef profile for DirectX. OpenGL can use both the Reach and the HiDef profiles.

Building

  • No problems building in Visual Studio 2022.
  • The nuget for OpenGL after building contains a dependency on Monogame.Framework.WindowsDX. I have to use the .nupkg editing tool to correct the dependency to Monogame.Framework.OpenGL.

License

The MerjTek.MonoGame.OpenVr project is under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 263 2/25/2023
1.0.0 221 2/22/2023

1.0.1 - Updated the Controller information so that once a profile is properly set up, the joystick, trackpad, and axes information plus all button indices can be properly read.
1.0.0 - Initial Release