Jump to content
  • Advertisement
Sign in to follow this  
pljones_

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

This topic is 2789 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
{
set
{
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)
Source=SlimDX
StackTrace:
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
Advertisement
...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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!