openvr icon indicating copy to clipboard operation
openvr copied to clipboard

Why do I get a black texture from IVRVirtualDisplay's Present

Open cshan opened this issue 2 years ago • 3 comments

I'm trying to implement a virtual HMD, I've inherited both IVRDisplayComponent and IVRVirtualDisplay, but no matter what I try, I always get a black texture from Present. I am referencing this repo: https://github.com/ValveSoftware/virtual_display

cshan avatar Feb 20 '23 10:02 cshan

Assuming you've figured out how to get texture handle from the shared texture passed to Present(), you'll also need to get the IDXGIKeyedMutex from the texture handle and acquire it before using the texture (as well as release it after). There are so many possible reasons for "black texture", all the way from not getting the texture handle through to a bug in your shader code that you're using to draw it. You'll need to put a lot of error checking in your code to find your failure point.

TheDeveloperGuy avatar Mar 19 '23 14:03 TheDeveloperGuy

I have a similar problem. when I build this sample: https://github.com/ValveSoftware/virtual_display I found the second display is always blue. when I use "if" instead of "while" on this line:https://github.com/ValveSoftware/virtual_display/blob/master/virtual_display/virtual_display.cpp#L299 Looks like it's working properly. But when I turn my head left and right, the whole picture rotates around its central axis(as if to flip), like a door being pushed open. Here are some pictures: https://github.com/2621690255/SteamVRTexture I don't know if this is normal. I'm look forward to your reply. @TheDeveloperGuy

2621690255 avatar Mar 22 '23 03:03 2621690255

I've never actually run that example, I used it as a reference when I code my IVRVirtualDisplay driver several years ago. I don't work for Valve or provide developer support on their behalf. If I see a question I can answer easily, based on my own experience, I answer it. I cannot answer yours, @2621690255. Good luck!

TheDeveloperGuy avatar Mar 23 '23 13:03 TheDeveloperGuy