Jump to content
  • Advertisement
Sign in to follow this  
Crost

DX11 Handling multiple rendered objects in DX11

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

I'm a beginner here, so my knowledge doesn't go too much farther than the MS tutorials (As found here: http://msdn.microsoft.com/en-us/library/ff729717(v=VS.85).aspx ) As is, I can render a single 3d object to the screen. I have a long list of vertices and indices, and throw these into the buffer on initialization. However, the tutorials never handled having separate objects; only the same object drawn at different coordinates. So I am at a bit of a loss as to how to properly go about things, or what direction I should be going in.

As best I can figure, I can handle this with a single vertex buffer if the objects are all organized, but this seems like it would be rather awkward to do. Largely because I'd have to deal with constantly loading/unloading objects to it.

Multiple vertex buffers would work better, though I don't know how efficient it is. When the program loads/initializes then I'm guessing I'd have to manage an array of however many buffers there are, and go through all of them upon rendering.

Sorry if I've been vague but DirectX is a subject I'm not familiar with yet. Really I just need direction as I no longer have a clue what I am doing. I know I won't be loading/unloading objects all that frequently (it's a 2 1/2 D fighter I'm working on). Efficient would be great, but given my lack of expertise 'simple but shippable' would probably cut it.

Share this post


Link to post
Share on other sites
Advertisement
Create a new vertex-buffer for each object, and draw them the same way but using the correct buffers/textures. The simplest is probably to create a class that contains all the necessary resources and a Draw() method, and keep a vector of such objects.
Try to share as much as possible, for example the model class shouldn't need to contain the constant-buffer, as the same one can be reused, and it's updated for every model drawn anyway. Unless you have very many models it doesn't matter too much if you have multiples of some objects however.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!