1

I'm trying to load a Direct Draw Surface into a Texture2D var using the SharpDX toolkit. So I created that var, called it pixel, created a dds file using paint.net and named it asdf.dds. I moved that file in the Content folder of my Project and changed the "copy to output directory" to "Copy if newer". If I now use

pixel = Content.Load<Texture2D>("asdf.dds");

I get the following exception (in german):

In SharpDX.SharpDXException ist eine Ausnahme vom Typ "SharpDX.DLL" aufgetreten, doch wurde diese im Benutzercode nicht verarbeitet.

Zusätzliche Informationen: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.

My horrible translation:

In SharpDX.SharpDXException an exception of the type "SharpDX.DLL" occured, but wasn't handed in user code. Aditional information: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.

jalgames
  • 781
  • 4
  • 23
  • How big is your texture? With a name like "pixel" could it be 1x1? – MattDavey Nov 29 '13 at 11:10
  • Exactly. It'a a one pixel sized texture with the RGP value of 255 255 255 (white). – jalgames Nov 29 '13 at 12:55
  • Have you observed this problem loading textures of other sizes? Most graphics cards have a maximum texture size, although some also have a minimum texture size - this would typically not be advertised through d3dcaps in the same way that the maximum size would be. Maybe try a 32x32 just to be sure? (Be sure to keep all other factors consistent). – MattDavey Nov 29 '13 at 13:02
  • 1
    That works! Thanks for your help, although I really don't know why this happend. I used XNA to create a number of Windows Phone games and I used single-pixel-textures often to rapidly prototype games and I never had a problem and now it doens't work. – jalgames Nov 29 '13 at 13:07
  • It could be that XNA was automatically upsizing the texture for you, SharpDX is not quite so helpful/interfering :) – MattDavey Nov 29 '13 at 13:25

0 Answers0