XNA Creators Club Online
Page 1 of 1 (5 items)
Sort Posts: Previous Next

Wierd Problem Loading Models with Textures

Last post 1/21/2009 6:38 AM by magicalhobo. 4 replies.
  • 10/28/2008 7:07 AM

    Wierd Problem Loading Models with Textures

    I am having a wierd problem loading Models that have textures.

    I'm running Windows Vista (32bit) and I have an ATI Radeon x1650 Video Card.

    I can play the SpaceWar game just fine, no problems. I can load models without textures just fine. However when I try to use a model with textures, I get the following exception error:

    "The device does not support creating a texture of the given format with the given TextureUsage. Parameter name: format"

    From what I've read it's running into a problem loading the texture because of the format (color format?). I'm not really sure what to do to fix it though.

    I declare my model at the top of the class with the line:   Model myModel;
    I try to load it in the LoadContent function with the line:  myModel = Content.Load<Model>("model");

    The LoadContent line is where my program stops with an exception.

    I don't run into any problems with it finding the files (when I did I just put them in the right place).

    I'm just wondering if anyone has any ideas on what may be going on or any suggestions on possible workarounds.

    Thanks.

    Edit:  I've tried this using both XNA 2.0 and 3.0 with the same results.
  • 10/28/2008 2:51 PM In reply to

    Re: Wierd Problem Loading Models with Textures

    To figure this out, we need to know what format your texture is using. How do you load this model? What processor properties do you have set when you build it?
    XNA Framework Developer - blog - homepage
  • 10/28/2008 8:49 PM In reply to

    Re: Wierd Problem Loading Models with Textures

    Thanks Shawn.

    Well I am loading the model using the Content.Load<Model>("modelName") line from within the content loader function.
    I'm sure on what the texture format is. Basically it's whatever the models in the Spacewars (example game that comes with XNA) uses.
    As far as the processor properties, it's all set to the default factory settings. I've never changed them.

    Edit:  I may be confused on the term "Processor Properties". Do you mean the properties on how the content is included? Or do you mean the various effects and stuff you can set? Either way I don't change anything. I just started out with clean projects and all I did was tried to load my Model. I didn't even get to the point of drawing my model. It fails in the loadcontent method.
  • 10/30/2008 2:45 PM In reply to

    Re: Wierd Problem Loading Models with Textures

    The processor properties are the options that appear under the Content Processor node in the Visual Studio properties pane, when you select the model asset. They will be collapsed by default: click the + sign next to the Content Processor selector to expand them. In here you will see things like Texture Format, Generate Mipmaps, etc. It would be interesting to know what values these are set to.

    Also, what model are you using? What textures does it have on it? What size and format are these textures?
    XNA Framework Developer - blog - homepage
  • 1/21/2009 6:38 AM In reply to

    Re: Weird Problem Loading Models with Textures

    Hi, sorry to bring up an old post, but I'm having the same problem.  I'm running Vista x64 with a Radeon HD3870. (Should be more than good for the minimum requirements)  I could get past that error for the Textures, by changing the "Texture Format" from DxtCompressed to Color.  But, when the font part came, my trick doesn't work anymore :(  Fonts have options for the Content Processor.  I can't figure out any way to influence the SurfaceFormat (DxtCompressed seems to be the problem) that gets used while using Content.Load.  I thought that was one of the great things about XNA... abstracting all the D3D_CAPS, and using software emulation automatically when it has to.  Right?  Here's my stack trace:

       at Microsoft.Xna.Framework.Graphics.Texture2D.CreateTexture(GraphicsDevice graphicsDevice, Int32 width, Int32 height, Int32 numberLevels, UInt32 usage, _D3DPOOL pool, SurfaceFormat format)
       at Microsoft.Xna.Framework.Graphics.Texture2D..ctor(GraphicsDevice graphicsDevice, Int32 width, Int32 height, Int32 numberLevels, TextureUsage usage, SurfaceFormat format)
       at Microsoft.Xna.Framework.Content.Texture2DReader.Read(ContentReader input, Texture2D existingInstance)
       at Microsoft.Xna.Framework.Content.ContentReader.InvokeReader[T](ContentTypeReader reader, Object existingInstance)
       at Microsoft.Xna.Framework.Content.ContentReader.ReadObjectInternal[T](Object existingInstance)
       at Microsoft.Xna.Framework.Content.ContentReader.ReadObject[T]()
       at Microsoft.Xna.Framework.Content.ContentReader.ReadAsset[T]()
       at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T](String assetName, Action`1 recordDisposableObject)
       at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)
       at WindowsGame3.Game1.LoadContent() in G:\My Documents\Visual Studio 2008\Projects\WindowsGame3\WindowsGame3\Game1.cs:line 126
       at Microsoft.Xna.Framework.Game.Initialize()

    Thanks,
    Sean.
Page 1 of 1 (5 items) Previous Next