Skip to main content
GameDev.net gamedev.net
🔒 Locked

Vertex & Index Buffer

Started by Nickie Jul 30, 2012 at 3:45 PM 1 replies 1.2k views
Original Post
Nickie
Nickie
Hello,
So I've recently been writing my scene graph and one question came in my mind...
All books I have ever read use directly LPDIRECT3D.....BUFFER objects in the node. But what will happen if there are 2 node with the same mesh?
So is direct3d checking if there are more then one buffers with same content and is there memory which is being waste?
Shoud I create my own mesh manager? (I have already got resource cache which can load zip files and manage used memory for assets)
MJP
MJP

So is direct3d checking if there are more then one buffers with same content and is there memory which is being waste?


No. If you make the 2 vertex buffers with the same contents, you'll waste memory. It's up to you to somehow share the mesh data among the different objects in your scene. Having the objects reference a mesh and using a resource manager to make sure each mesh only gets loaded once is a pretty common way of solving this sort of problem.
Nickie
Nickie

[quote name='Nickie' timestamp='1343663114' post='4964521']
So is direct3d checking if there are more then one buffers with same content and is there memory which is being waste?


No. If you make the 2 vertex buffers with the same contents, you'll waste memory. It's up to you to somehow share the mesh data among the different objects in your scene. Having the objects reference a mesh and using a resource manager to make sure each mesh only gets loaded once is a pretty common way of solving this sort of problem.
[/quote]

Thats what I needed. Thanks.
Now I just need to make a std::list of all meshes and link them with a string(the name of the file). My resource cache is optimized for getting resources from name so I can easily locate the original data and build when needed or just access. Thanks, again!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.