2
\$\begingroup\$

I'm new to Direct3D, I'm currently learning Direct3D 10 in Uni. I'm confused about buffers and meshes. We've been shown code to draw cubes etc that use ID3D10Buffer. However I've seen some stuff online that uses ID3DX10Mesh to draw cubes.

What's the advantage/disadvantage for each of them? ID3DX10Mesh seems more versatile, I guess this comes with a cost?

\$\endgroup\$
1
  • \$\begingroup\$ Generally the objects with X in them (like ID3DX10Mesh, versus ID3DBuffer note with no X) are from the D3DX utility library and provide some kind of advanced functionality. \$\endgroup\$
    – bobobobo
    Commented Nov 21, 2012 at 20:49

1 Answer 1

2
\$\begingroup\$

ID3DX10Mesh is a higher-level wrapper. Internally, I expect it uses ID3D10Buffers and other things to render the mesh, but it keeps track of all the data for you and provides convenience functions that implement more complex operations. The upside is that you don't have to implement all that stuff yourself; the downside is the same one as with all higher-level wrappers, that if you want to do something outside of what it the class was designed for, it may be inefficient or even impossible.

On the other hand, ID3D10Buffer is a very low-level object that basically just represents a chunk of VRAM in which you can store more or less arbitrary data, and which you can use as an input to shaders. When used to store vertex and index buffers they can be used to draw a mesh, but they also store shader parameters (in which case they're called "constant buffers").

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .