Forum Discussion
jobrandh
9 years agoHonored Guest
Update texture in OculusRoomTiny example (DX11)
Hi!
I've been digging through the wonderful examples in the 0.8 SDK and I've been writing my own application by modifying the tiny room example. I'm currently stuck on trying to update a texture dynamically (every other frame or so), and my DX11-fu is not nearly strong enough to figure it out.
Does anyone know how to update for example one of the walls to use data from an image frame (assume data is well formatted in an array with size known)?
The Win32_DirectXAppUtil.h has a Texture struct that seems to be the right place but I cant figure out what I need to do.
Thanks for any help!
I've been digging through the wonderful examples in the 0.8 SDK and I've been writing my own application by modifying the tiny room example. I'm currently stuck on trying to update a texture dynamically (every other frame or so), and my DX11-fu is not nearly strong enough to figure it out.
Does anyone know how to update for example one of the walls to use data from an image frame (assume data is well formatted in an array with size known)?
The Win32_DirectXAppUtil.h has a Texture struct that seems to be the right place but I cant figure out what I need to do.
Thanks for any help!
4 Replies
- jhericoAdventurerhttp://stackoverflow.com/questions/1495 ... tx-texture
- jobrandhHonored GuestThanks for the link, but I was wondering if anyone else had specific experience with the example in Win32_DirectXAppUtil.h. The link is about DX9 and the 0.8 SDK implementation is using DX11. My googling has led me to believe that I may need to use the "Map" function https://msdn.microsoft.com/en-us/librar ... 57(v=vs.85).aspx, but I was looking to see if anyone else had tackled a problem like this before.
Thanks! - LKostyraProtegeIMO this should be easy, however depending what you want to do.
I would recommend starting with switching between two textures:
* Create two D3D11 textures
* Fill them with whatever resources are needed
* At rendering stage, switch between them by binding different textures to the same shader slot
As far as I remember D3D11 correctly, there is this thing called Shader Resource View (SRV). You need to do the binding there.
More details when I get home from work. :) - mattnewportProtegeYou probably want to take a look at ID3D11DeviceContext::UpdateSubresource(). Note that you will need to update all the mip levels for the texture, not just the first, or use a texture with the appropriate flags set on creation (D3D11_BIND_RENDER_TARGET, D3D11_BIND_SHADER_RESOURCE, and D3D11_RESOURCE_MISC_GENERATE_MIPS) and call ID3D11DeviceContext::GenerateMips().
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 2 months ago
- 10 months ago
- 10 months ago
- 5 months ago