MerjTek.MonoGame.OpenVr.OpenGL
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package MerjTek.MonoGame.OpenVr.OpenGL --version 1.0.0
NuGet\Install-Package MerjTek.MonoGame.OpenVr.OpenGL -Version 1.0.0
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.0" />
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.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MerjTek.MonoGame.OpenVr.OpenGL, 1.0.0"
#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.0 // Install MerjTek.MonoGame.OpenVr.OpenGL as a Cake Tool #tool nuget:?package=MerjTek.MonoGame.OpenVr.OpenGL&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MerjTek.MonoGame.OpenVr
MerjTek.MonoGame.OpenVr is a library that works on WIndows to add OpenVR (SteamVR) abilities to a MonoGame project.
ToDo List
- Controllers
- Update the OVRControllerProfile to include axis information forthe touchpad, joystick, and or triggers
- Update the bits of each button in every profile once I obtain the correct information.
- DirectX
- Solve the Rendertarget2D submission errors.
Nuget Packages
-[ MerjTek.MonoGame.OpenVr.DirectX ] v1.0.0 - Not published
- MerjTek.MonoGame.OpenVr.OpenGL v1.0.0
How To Use
After Installing the Nuget Package:
...
// In Game1.cs add the using statement below:
using MerjTek.MonoGame.OpenVr;
...
...
// 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
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
The DirectX library currently does not work. Nothing appears in the VR glasses. Rendering the left eye to the screen works. Why?
- Calling Submit on each eye's RenderTarget2D fails with a EVRCompositorError.SharedTexturedNotSupported error.
- OpenVR documentation: (Error) SharedTexturesNotSupported (application needs to call CreateDXGIFactory1 or later before creating DX device)
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 | Versions 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.
-
net6.0-windows7.0
- MonoGame.Framework.DesktopGL (>= 3.8.1.303)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
1.0.0 - Initial Release