Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Monogame texture submit to HtcVive (OpenVR)

$
0
0

@11110 wrote:

is anyone have experience submit monogame rendertarget to HtcVive(openvr_api).
Am i correct by using this method to get the native pointer for texture?

public override int SubmitRenderTargets(RenderTarget2D renderTargetLeft, RenderTarget2D renderTargetRight)
{
var info = typeof(RenderTarget2D).GetField("_texture", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
var handleLeft = info.GetValue(renderTargetLeft) as SharpDX.Direct3D11.Resource;

        var Right = info.GetValue(renderTargetRight) as SharpDX.Direct3D11.Resource;

        var tex1 = new Texture_t
        {
            eType = EGraphicsAPIConvention.API_DirectX,
            eColorSpace = EColorSpace.Auto,
            handle = handleLeft.NativePointer
        };
        var tex2 = new Texture_t
        {
            eType = EGraphicsAPIConvention.API_DirectX,
            eColorSpace = EColorSpace.Auto,
            handle = handleLeft.NativePointer
        };

        OpenVR.Compositor.Submit(EVREye.Eye_Left, ref tex1, ref _textureBounds[0], EVRSubmitFlags.Submit_Default);
        OpenVR.Compositor.Submit(EVREye.Eye_Right, ref tex2, ref _textureBounds[1], EVRSubmitFlags.Submit_Default);
        return 0;
    }

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles