Archived

This topic is now archived and is closed to further replies.

D3D device, should i make my d3d class singleton?

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

Hi, im making a class around the d3d device, eg to initialise it, cleanup etc. Im wondering if i should make it a singleton, as ive heard people say the the d3d device should be used, eg initialised etc. But what about if you have multiple windows eg a map editor, one for xy , zy, xz, 3d views. would you need a new d3d device to render on each view, eg a view uses a new window, thats how many 3d editors seem to do it. So basically should the d3d device only to be initialised once, if so id make it a singleton...

Share this post


Link to post
Share on other sites
Same device, different viewports for those editing style views AFAIK.

I put my D3D device class as a monoinstance, inside of my Renderer monoinstance and I pass it out when needed. You''re stucking handing out devices, or make some sort of Index and Vertex buffer manager, among other things that use the device.

Share this post


Link to post
Share on other sites
use IDirect3DSwapChain8 for multiple viewports, not multiple devices. you can't share video resource between devices (at least not easily, I don't know of any way to do it), so an editor done like that would require 4x as much memory as the game.

edit: or of course, IDirect3DSwapChain9

[edited by - billybob on March 25, 2004 11:28:37 PM]

Share this post


Link to post
Share on other sites