Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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#.

share|improve this question
1  
You should consider looking at SlimDX. Not that I know if it's better or not, but it's often recommended. –  William 'MindWorX' Mariager Mar 7 '12 at 15:30
    
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. ;) –  msedore Mar 7 '12 at 15:36
add comment

1 Answer 1

up vote 4 down vote accepted

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! :)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.