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 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?

share|improve this question
    
Based on your questions, and for such a small amount of vertices, I have a sneaking suspicion you may be better off with DrawUserPrimitives. –  Andrew Russell Apr 22 '11 at 2:02
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
add comment

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.