DrawPrimitive:D3DPT_TRIANGLEFAN performance

Started by
1 comment, last by sepul 18 years, 10 months ago
if the geometric data is constructed with polygons (not triangles), and most of the polys are quads, which Drawing type is more efficient? using multiple calls to D3DPT_TRIANGLEFAN for each poly? or divide all polys into triangles and use D3DPT_TRIANGLELIST ? another question, when I'm calling DrawPritmive with D3DPT_TRIANGLEFAN for each poly, does the draw functions return immedietly ? so I can go on, and do something with the cpu at the same time ?

dark-hammer engine - http://www.hmrengine.com

Advertisement
Of the two, triangle lists will be massively more efficient. You might also want to consider triangle strips.

The draw functions do return before the polys are actually drawn, so you can be doing something on the CPU while the graphics card is chugging away. However, those draw calls are not cheap, so you don't want to be making one call per poly.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

is it even more efficient if I have to divide all polys, make their verts, put them into the buffer and render them for each frame ?

it really depends on geometry, for example if you are rendering a room which each texture is used on two or four polys , you still have to make several calls to DrawPrimitive for triangle lists, in that case I think triangle fans will be more efficient cuz they are using less vertices.

for example a room has four walls with a brick texture, a ceiling and a floor:
Walls->
Triangle Fans: SetTexture(brick) -> 4 quad polys -> 4*4=16 vertices to the pipline, but four calls to DrawPrimitive

Triangle List: SetTexture(brick) -> 4 quad polys -> 4*6=24 vertices to the pipeline, but 1 call to DrawPrimitive

I cosidered using index buffers too, but they are not effecient for a level that contains 100,000 polygons, with lots of texture/lightmap changes, and also I have to do collision detection on the polys several times for each frame, which is faster to read from system memory.

dark-hammer engine - http://www.hmrengine.com

This topic is closed to new replies.

Advertisement