Archived

This topic is now archived and is closed to further replies.

lor3

Primitive Shapes - Does it matter?

Recommended Posts

I just had a thought while trying to figure out how to group calls to DrawPrimitive() considering objects may have different primitive lists. If you use trianglelists, with an index buffer u''ll be re-using vertices anyway so you don''t have to use trilists, fans or anything else. Anyone want to comment?

Share this post


Link to post
Share on other sites
You know, I''m not certain on this, but I think that fans and strips are like cheap index buffers. Where index buffers are the ''correct'' way to do things in D3D, but if you must, you can use fans or strips because they are simpler.

That''s just the take I got from reading the SDK docs.

_____________________________________________
Come join us on IRC in #directxdev @ irc.afternet.org

Share this post


Link to post
Share on other sites
Interesting.. i will give that a go then (manually converting tristrips/fans to tri-lists using index buffer on init)...

The real problem i''m having creating an efficient renderer is making calls to DrawPrimitive() have a decent number of verts.

For instance, grouping textures and draw states is a simple task, but in all likelyhood, every "object" in the game world are going to have different transformations - and for verts within that object that do share transformations, are most likely going to be part of a different renderstate/texture group....!

Considering ATM i have max 50 textured quads on the screen i shouldn''t be worrying about speed, but i like to do things "right"

Share this post


Link to post
Share on other sites
Hehe, sounds like what I''m doing with building that GUI of mine, lor3. If you want to learn how to do something right, give yourself this little challenge: Have most or all objects use the same vertex buffer.

IMHO Locking vertex buffers is a far worse bottleneck than playing with matrixes or choosing between fans/strips/indexed.

Especially not at the number of triangles you''re processing... Still, have a look at the SDK docs, make a search for ''Performance optimizations'' and look at what they say about vertex buffers, it''s very useful to know.

P.S. Looking all about the forum, I see zillions of opinions about what is quickest - and it varies depending on the hardware/software. This brings me back to what my comp. science teacher used to say: "There is no single right way to do things in computer science, there are many good solutions"

Share this post


Link to post
Share on other sites
Already done... Well sortof. I have a single vertex/index buffer pair per StateClass - which contains the FVF etc.

Only time the buffer(s) get locked is during the 3dobjects initialisation, everything after that is done with matrices.

Obviously it only works for simple models. I plan to put the whole thing online t some point.

Share this post


Link to post
Share on other sites