Advertisement

Method to store resources

Started by November 15, 2021 02:53 PM
2 comments, last by Calin 3 years, 2 months ago

How does one stores a DirectX resource in a C++ program. Let`s say I want to place several buffers in an array so that I can iterate through them. Do I need to create an array of pointers?

ID3D10Buffer* g_pVertexBuffer = NULL;

My project`s facebook page is “DreamLand Page”

Yes, D3D uses COM so you'll always be dealing with pointers to interfaces. It's pretty standard to store in an array/std::vector/etc of pointers. You can also use a COM smart pointer too if you prefer to have something handle calling AddRef/Release for you automatically. Those can also be stored in arrays just like a pointer.

Advertisement

Thanks MJP

My project`s facebook page is “DreamLand Page”

This topic is closed to new replies.

Advertisement