microsoft / Win2D

Win2D is an easy-to-use Windows Runtime API for immediate mode 2D graphics rendering with GPU acceleration. It is available to C#, C++ and VB developers writing apps for the Windows Universal Platform (UWP). It utilizes the power of Direct2D, and integrates seamlessly with XAML and CoreWindow.
http://microsoft.github.io/Win2D
Other
1.8k stars 285 forks source link

Win2D Gallery Direct3D Interop Hololens and C# #341

Closed juanpaexpedite closed 8 years ago

juanpaexpedite commented 8 years ago

I really enjoy the Win2D Gallery app, it would be great that the teapot example get all ported to C#. My technical question here is: Does Hololens render the teapot in holographic 3D or what does it do a flat render?

shawnhar commented 8 years ago

The teapot example uses C++ because it relies on the DirectX Tool Kit (https://github.com/Microsoft/DirectXTK) to draw the teapot, and DirectXTK is a native C++ API.

Doing the same thing in pure C# would be significantly more work for two reasons:

  1. We'd have to build the teapot geometry and shaders to render it directly into the sample, which would distract from the point we are trying to demonstrate. The goal is to show how to interop between Win2D and Direct3D, without getting distracted by the details of how to use Direct3D itself. Using DirectXTK lets us easily draw an interesting 3D shape while minimizing the amount of Direct3D code not directly related to how this sort of interop works.
  2. To do this in pure C#, we'd have to use some other C# Direct3D binding (eg. SharpDX or SlimDX) - but we didn't want Win2D to take such a big dependency just for this one sample.
shawnhar commented 8 years ago

On your other question, there are special APIs for holographic rendering. See:

shawnhar commented 8 years ago

Closing issue as I believe these questions have been answered.