3
\$\begingroup\$

I am new to game development, having only developed a few games before, in 2D space, but with 3D rendering.

I have implemented instancing before, but this is only my 2nd time doing it. I have a question regarding instancing.

To do instancing, I have a geometry buffer having a vertex declaration (for instance) 32 VertexPositionColor elements. This is because I have a few elements with 32 vertices in them.

I am rendering all elements as linelists. However, there are some elements in the list that doesn't have 32 vertices. I would like to include these in the instancing render process too.

So my final question is, what happens if I (for instance) fill out 8 of the vertices with their indexes, but then still send all the 32 vertices into the instancing shader? Is it possible?

Is there a better approach to be able to instance all kinds of elements, with various vertex counts?

\$\endgroup\$
1
  • \$\begingroup\$ Based on your questions, and for such a small amount of vertices, I have a sneaking suspicion you may be better off with DrawUserPrimitives. \$\endgroup\$ Apr 22, 2011 at 2:02

1 Answer 1

2
\$\begingroup\$

Resizing or creating a buffer is a costly operation, don't do it at draw-time.

There is no processing cost for having unused vertices in your vertex buffer (or unused indices in your index buffer, for that matter). They just take up a small amount of memory.

\$\endgroup\$

You must log in to answer this question.

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