XNA Drawing a series of squares -


i trying draw series of squares in xna. looking @ these articles trianglestrips , dynamicvertexbuffers. but, not sure begin.

current step able draw 1 square using vertexpositioncolor, trianglelist , indices. want draw series of squares varying colors.

end goal keep in mind number of such squares able draw, eventually. if assume 5px width, on 1920x1080 screen, can calculate number of squares (1920 * 1080) / 25 = 82944.

any pointers on how accomplish great!

generally, can draw more squares in same way draw first one. however, there significant loss in performance.

instead, can add triangles 1 vertex buffer / index buffer. able draw 2 triangles triangle list. should able adjust routine draw more 2 triangles. add according vertices , indices buffers , modify draw call.

if need vertices @ same position different colors, need add 2 vertices buffer.

this way, performance loss little, because draw 1 draw call. although amount of triangles should no problem graphic cards, smaller or older ones can trouble. if so, should consider changing drawing strategy. maybe not necessary draw triangles. can think that, if resulting performance low...


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -