Jump to content
  • Advertisement
Sign in to follow this  
jdub

(DirectX)Stupid question about Textures and Lost Devices

This topic is 3372 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

Do I have to destroy and then reload Textures each time the device is lost? Here is what I am currently doing: void LoadContent() { LoadTexture("...\\MyTexture.png", out CharacterTexture); } void UnloadContent() { this.CharacterTexture.Dispose(); } I have noticed that Sprites have OnDeviceLost() and OnDeviceRestored() methods. Why can't I call these methods on Textures instead of reloading them?

Share this post


Link to post
Share on other sites
Advertisement
Is this MDX?

Anyway if a texture is created in D3DPOOL_MANAGED (I think it's called Pool.Managed in MDX), then it doesn't need to be re-created. The runtime will back up its contents in system memory, and automatically restore it for you when a lost device scenario occurs. However if it was created in D3DPOOL_DEFAULT (Pool.Default), then you have to destroy it and create a new one.

The Sprite class has the OnDeviceLost and OnDeviceRestored methods because it's not actually a resource...it's a class that maintains its own resources internally (specifically, a dynamic vertex buffer). Therefore it gives you methods to let it know that it should destroy and recreate those resources.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!