1

I am starting from the default Hololens template (https://developer.microsoft.com/en-us/windows/holographic/creating_a_holographic_directx_project) and I'd like to modify the cube so that instead of having an interpolated rainbow on its faces it has textures.

Did I mention that I do not know C# or DirectX (although I do know Java, Python, WebGL, and java's OpenGL)? So I am rather confused by how many source examples seem to be for obsolete versions of windows APIs.

Anyway, I was able to create a Texture2D object using code from SharpDX 3.0.2 D3D11 - How to load texture from file and make it to work in shader? . (although all I can be sure of is that it didn't crash or make the rainbow cube fail).

I have also found sample code at https://gist.github.com/axefrog/b51b4e149c329608eae6 that leads me to believe I need to

pixelShader.SetShaderResource(0, textureResourceView)
pixelShader.SetSampler(0, samplerState)

Unfortunately the

textureResourceView = new ShaderResourceView(device, texture);

constructor does not exist in the libraries available to me (SharpDX.Direct3D11 ?) and all VisualStudio offers me is

ShaderResourceView(IntPtr nativePtr)

Is there sample code that shows how to use a texture in a C# application using HLSL shaders and actually works using the reduced APIs supported by the Hololens?

And don't tell me to use Unity. We already kicked Unity and Unreal to the curb because they do not yet have the features we need.

Community
  • 1
  • 1
Mutant Bob
  • 3,121
  • 2
  • 27
  • 52

1 Answers1

1

Evidently the

new ShaderResoruceView(device,texture)

constructor does exist, and something about the way I typed it in VisualStudio was wrong and triggered an error, and I misinterpreted the popup that mentioned the IntPtr constructor as being the only one available instead of being one of several options.

Mutant Bob
  • 3,121
  • 2
  • 27
  • 52