Sign in to follow this  

[SlimDX] Surface.AsSurface() throws "E_NOINTERFACE..." (resolved)

Recommended Posts

I'm trying to do something "really simple" in my first ever use of DirectX.

Of course, it's made more complicated by doing it from C#... I'm using SlimDX (June 2010). I've got Microsoft DirectX SDK (June 2010) installed. I checked I've got the runtime installed as best I could (the samples run for both the Microsoft SDK and SlimDX).

I can compile my code. It's very simple - it's attempting to read DDS data and write it to an Image. I don't quite get that far, however.

public System.IO.Stream Data { set { Texture = Texture2D.FromStream(dev, value, (int)value.Length); } }

public Texture2D Texture
Surface surface = value.AsSurface();
DataRectangle dr = surface.Map(SlimDX.DXGI.MapFlags.Read);
this.Image = Image.FromStream(dr.Data);

I pass in a Stream containing what I hope is DDS data. The Texture gets created OK -- that is, the set_Texture method is invoked okay. The program fails on the call to "value.AsSurface()", with

SlimDX.Direct3D11.Direct3D11Exception was unhandled
Message=E_NOINTERFACE: The requested COM interface is not available (-2147467262)
at SlimDX.Result.Throw[T](Object dataKey, Object dataValue)
at SlimDX.Result.Record[T](Int32 hr, Boolean failed, Object dataKey, Object dataValue)
at SlimDX.Result.Record[T](Int32 hr, Object dataKey, Object dataValue)
at SlimDX.Direct3D11.Resource.AsSurface()
at S3PIDemoFE.DDSWidget.set_Texture(Texture2D value) in P:\Source\Sims3\S3PIDemoFE\DDSWidget\DDSWidget.cs:line 46
at S3PIDemoFE.DDSWidget.set_Data(Stream value) in P:\Source\Sims3\S3PIDemoFE\DDSWidget\DDSWidget.cs:line 40
at S3PIDemoFE.MainForm.getValueControl() in P:\Source\Sims3\S3PIDemoFE\MainForm.cs:line 1628

I can't find any help on what the error message means, either in general or specifically to SlimDX. I'm guessing I'm missing some library?

Clues most appreciated! :)

Obviously, the biggest help would be an explanation of how to convert DDS data into a Bitmap using SlimDX... :D

[Edited by - pljones_ on October 4, 2010 8:04:45 AM]

Share this post

Link to post
Share on other sites
...Thinking about it overnight, I guess I'm coming at this from the wrong angle...

I just want to display (one of the MIPMAPs from) the DDS in a Windows Control that can be positioned as part of laying out the application main window. I'll go look that up, as I'm sure I saw something about it.

Share this post

Link to post
Share on other sites
I copied from the SlimDX Samples ...\Direct3D9\WPF Interop\WpfSample\, creating my own XAML and rendering engine. Seems to work.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this