Original Post
Hey all, In coding my game UI, I've now come to the point where I'm implementing a button/combo box to change resolution. I have managed to get the device to reset correctly, restoring all resources afterwards, but it has hit me that keeping track of all my D3D resources (such as index and vertex buffers) is quite a pain when they aren't centralized in some manner as I ahve to manually locate all objects and release/restore any D3D resources they may contain. To that end, I've been thinking about creating a singleton class that looks after creation and distribution of vertex and index buffers, such that I can give this class Release/Restore functions that have access to all index and vertex buffers in one place, this would allow me to release resources, reset the device and restore resources in only a few function calls. I already have a design like this in place for textures, but this situation is a little different because textures may be used many times in many different objects, so a centralized resource makes more sense in this case, index and vretex buffers I think tend to be more unique, so I'm not sure if this is the best idea or not. This does however seem to be much easier to track than having them scattered in many different objects. Objects can then access their buffers by an ID of some sort (integer or string based) when needed. Now, I'm not sure this sits particularly well with object oriented design and I'm wondering if it might cause me problems in other areas of the program in future... does anyone have any opinions on this idea? If so I'd be grateful to hear them! Is a singleton design a bad idea in this case, or acceptable given the ease of use that would result? Many thanks, Steve