1
\$\begingroup\$

I'm trying to render bitmap fonts in directX10 at the moment, and I want to do this as efficiently as possible. I'm having a hard time getting a start on my design because of this question though.

So should I reuse a single VertexBuffer or make multiple VertexBuffer objects?

Currently I allocate one dynamic VertexBuffer per Quad object in my program. This way I wouldn't have to map/unmap a VertexBuffer if nothing moves on my screen. For fonts I can implement a similar method on where I allocate one buffer per text box, or something similar.

After searching I read about reusing a single VertexBuffer for all objects. Vertex caching came up also. What is the advantage/disadvantage of this, and is it faster than my previous method?

For last, is there any other method I should look into rendering many 2d quads in the screen?

Thank you in advance.

\$\endgroup\$
2
  • 3
    \$\begingroup\$ "Most efficient" is a bad thing to aim for. You're not making GTA6. Aim for easy to implement and easy to understand. Also, there is almost literally zero reason to use DX10 instead of just using DX11; the only OS that supports DX10 but not 11 is unpatched Vista (Vista SP2 added DX11). \$\endgroup\$ Commented Jan 20, 2014 at 6:14
  • 1
    \$\begingroup\$ Well I'm also aiming to be efficient for learning purposes aka for future use. Why not explore all my options? And thank you for the advice. I'll use DX11 on my next project then. \$\endgroup\$ Commented Jan 20, 2014 at 7:17

1 Answer 1

1
\$\begingroup\$

You may reuse VertexBuffer objects but this is harder to implement, but as @SeanMiddleditch said in his comment, this shouldn't be your goal, and creating new VBOs shouldn't matter in your application.

Currently I allocate one dynamic VertexBuffer per Quad object in my program

Per quad is an overkill and is probably the worst. This way your practically emulating immediate mode which has been deprecated for good.

Also storing all your scene in one vertex buffer is usually a bad idea. You may need to cull objects and not draw them in the first place in many occasions. Storing them in one VBO will particularly prevent you from doing culling operations.

Your best bet is to create new vertex buffers for each 3D model, try not to store small data or huge data.

My recommendation is that it shouldn't be your concern unless your application really took a performance hit. In that case profile and optimize accordingly.

After searching I read about reusing a single VertexBuffer for all objects. Vertex caching came up also. What is the advantage/disadvantage of this, and is it faster than my previous method?

Vertex caching is an advanced optimization and shouldn't be done unless you have a very performance critical application (like the next big AAA game, or a scientific visualization that deals with millions of data chunks), and btw vertex caching shouldn't matter for smaller scenes.

\$\endgroup\$
4
  • \$\begingroup\$ Thank you for the answer. I'll go for your advice. Is there any resources you can point to me for vertex caching though? I'm quite interested in the technique which can be used maybe for my future projects. \$\endgroup\$ Commented Jan 20, 2014 at 7:20
  • \$\begingroup\$ @user2280704 The article I linked in the bottom of the answer talks about such issue. \$\endgroup\$
    – concept3d
    Commented Jan 20, 2014 at 7:22
  • \$\begingroup\$ Oh that's embarrassing I didn't even notice that it's a link. Thank you again. \$\endgroup\$ Commented Jan 20, 2014 at 7:23
  • \$\begingroup\$ @user2280704 also this one developer.apple.com/library/ios/documentation/3ddrawing/… \$\endgroup\$
    – concept3d
    Commented Jan 20, 2014 at 7:23

You must log in to answer this question.

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