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

Two probably not very interesting questions

Last post 09/09/2007 18:11 by Catalin Zima. 2 replies.
  • 09/09/2007 17:56

    Two probably not very interesting questions

    1. What would normally get called in LoadGraphicsContent when loadAllContent is false?  Is that literally if you want to call LoadGraphicsContent yourself when particuarly things need to be loaded??
    2. Why doesn't e.g. audio content need to be re-loaded ever?  Are you meant to put audio code in LoadGraphicsContent (presumably not, given the name) - and if not, why not?

    Neither are major issues for me, just my curiosity working...

    Ta,

    Murray
    Muzz http://www.PositronicArts.com/blog
  • 09/09/2007 18:04 In reply to

    Re: Two probably not very interesting questions

    It's dependent on the ResourceManagementMode of the object you are creating or loading. You can see more details (albeit brief) here: http://msdn2.microsoft.com/en-us/library/microsoft.xna.framework.graphics.resourcemanagementmode.aspx. In general all your loaded models, textures, and effects will be need to be loaded when loadAllContent is true. Other things you'd want to load if loadAllContent is false would be custom textures you created with the ResourceManagement.Manual enumeration. I also put things like view and projection matrices in my load method so when a device gets reset, it it comes back a new size, I'm all set.

    There are other objects you can create as manual content that will require you to create them every time Load is called. Most though do also allow you to make them automatic. There are tradeoffs I'm not fully aware of, but mostly I stick with automatic resources so that the graphics device handles recreating the resources for me. I'm sure a good Google would take care of that.

    Think of it this way. Your graphics content is loaded and linked to your current graphics device. If that device gets reset or changed in a large way, your graphics content won't work properly so you have to reload it. Since audio isn't dependent on the graphics device, it won't ever need reloading after the initial loading. I usually load audio in the Initialize method because I know it will only ever get called once when it's in there.
  • 09/09/2007 18:11 In reply to

    Re: Two probably not very interesting questions

    1. any resource that is created with ResourceManagementMode.Manual

    LoadGraphicsConent is called whenever the devide need to be reset (loadAllContent==false), or recreated (loadAllCntent==true). I don't exactly know the whole theory of when each case happens, but XNA takes care of this for us.

    2. Since only the graphics device has problems sometimes (minimize / maximize / move from one monitor to another, etc), when it needs to be reset/recreated, then only resources that are related to the graphics device may need to be recreated. Audio is independent of the graphics, so no problem here.

    Edit: Nick explained it way better than me, but I didn't see his post before I wrote my reply.

Page 1 of 1 (3 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG