VBGamer |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Performance of DrawIndexedPrimitive Noah Adler (6 replies, 0 views) (2000-Jun-25) Well I recently decided to try to use DrawIndexedPrimitive in place of DrawPrimitive, hoping for a performance increase...but to my surprise, I got anything except an increase. The speed dropped an *enormous* amount! I thought the app was crashing, but nope, turns out it was just taking it's sweet time (maybe 30 seconds?) to render each frame!! Here's some code:
-----
vertIdx(0) = (i - 1) + (j - 1) * 64
vertIdx(1) = (i - 1) + (j - 1 + MapStep) * 64
vertIdx(2) = (i - 1 + MapStep) + (j - 1) * 64
vertIdx(3) = (i - 1 + MapStep) + (j - 1 + MapStep) * 64
vertSet(1) = MapVerts(vertIdx(0))
vertSet(2) = MapVerts(vertIdx(1))
vertSet(3) = MapVerts(vertIdx(2))
vertSet(4) = MapVerts(vertIdx(3))
' Render quad
d3ddev.DrawPrimitive D3DPT_TRIANGLESTRIP, D3DFVF_LVERTEX, vertSet(1), 4, D3DDP_DEFAULT
'd3ddev.DrawIndexedPrimitive D3DPT_TRIANGLESTRIP, D3DFVF_LVERTEX, MapVerts(0), 4096, vertIdx, 4, D3DDP_DEFAULT
-----
BTW, this is intended to render a single bent quad in a heightmap, in case you couldn't tell ;-) i and j are just variables used for iteration. I figured that I would save processing time by not having to copy the vertices from MapVerts() array into a temporary array to be used for rendering the quad, but apparently not! Well I obviously did something wrong, but I'm stumped...I'd greatly appreciate any help...thanks!!
Noah Adler
|