Sign in to follow this  
sepul

DrawPrimitive:D3DPT_TRIANGLEFAN performance

Recommended Posts

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

Share this post


Link to post
Share on other sites
superpig    1825
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.

Share this post


Link to post
Share on other sites
sepul    257
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this