Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  bobobobo Nov 21 '12 at 20:49

1 Answer 1

up vote 2 down vote accepted

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").

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.