2
\$\begingroup\$

I have converted my C# game from OpenTK (OpenGL) to SharpDX (DirectX) and have it up and running from Visual Studio 2010. I also have it up and running from Visual Studio 11 in Metro, in the Windows 8 Developer Preview. However, the Metro build is still lacking textures, so my polygons are simply colored right now. The problem is that the methods used to load images are absent in the Metro DLLs. These methods are all missing from the Texture2D class (inherited from the Resource class) in Metro:

SharpDX.Direct3D11.Resource.FromStream
SharpDX.Direct3D11.Resource.FromFile
SharpDX.Direct3D11.Resource.FromMemory

Does anyone know if these will eventually be implemented in Metro? Or is there an alternate approach I could be using? Please keep in mind that I never knew a thing about DirectX or SharpDX before this, so I'm still very wet behind the ears with all this.

Finding any kind of help or information for SharpDX is not easy, which is a shame, because it seems to be a great solution for 3D in Metro using C#.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ You should consider looking at SlimDX. Not that I know if it's better or not, but it's often recommended. \$\endgroup\$
    – William
    Commented Mar 7, 2012 at 15:30
  • \$\begingroup\$ I do find information I need sometimes through SlimDX, but it's not a solution for development right now since it currently doesn't work in Metro. And the fine folks at SlimDX certainly won't be adding the missing methods I need to SharpDX. ;) \$\endgroup\$
    – msedore
    Commented Mar 7, 2012 at 15:36

1 Answer 1

4
\$\begingroup\$

Good news! Alexandre Mutel, the author of SharpDX, let me know that Microsoft removed the "helper methods" from Direct3D11. It wasn't an omission by SharpDX. And he also pointed me in the right direction; to use WIC to load my textures. I found sample code here:

http://crazylights.googlecode.com/svn/CLReach/win8/SDX_CLGC/clgc.cs

I just needed two of the methods: LoadBitmap() and CreateTex2DFromBitmap(). I had to change the R8G8B8A8_UNorm_SRgb to R8G8B8A8_UNorm, but ultimately I got it working. And now my game now looks fabulous in Metro with all it's textures in place! :)

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .