Guest User

Untitled

a guest
Nov 17th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. // Texture sampler
  2. var textureSamplerDsc = new SamplerDescription()
  3. {
  4. Filter = D3D11Filter.Anisotropic,
  5. AddressU = TextureAddressMode.Wrap,
  6. AddressV = TextureAddressMode.Wrap,
  7. AddressW = TextureAddressMode.Wrap
  8. };
  9.  
  10. var textureSampler = SamplerState.FromDescription(device, textureSamplerDsc);
  11. context.PixelShader.SetSampler(textureSampler, 0);
  12.  
  13. // Load texture
  14. var texture = Texture2D.FromFile(device, "texture.jpg");
  15. var resourceView = new ShaderResourceView(device, texture);
  16.  
  17. // Pass it to graphic pipeline
  18. context.PixelShader.SetShaderResource(resourceView, 0);
  19. device.ImmediateContext.PixelShader.SetShaderResource(resourceView, 0);
Add Comment
Please, Sign In to add comment