Jump to content
  • Advertisement

Archived

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

Ilankt

should i use quads with drawprimitive for tiles?

This topic is 5428 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

because sprites dosent give me good rotation... and if i will use tiles, and lets say i will have let''s say 500 calls for drawprimitive, the program wont get slow?

Share this post


Link to post
Share on other sites
Advertisement
It depends on how you make the drawprimitive call. If you call drawprimitive 500 times every frame it will be too slow. If you create a vertex buffer and fill it with all your tile vertices and call drawprimitive once every frame then it will be extremely fast.

Share this post


Link to post
Share on other sites
it also depends on everything else, how complex the rest of your game is and stuff, and if your doing level-of-detail management - which you probably arent in this case.

but yeah, placing all vertices into a vertex buffer, even better using triangle strips, can all help in the performance area.

Share this post


Link to post
Share on other sites
Hmm...this brings up a question i never thought about.
When using triangle fans with DrawPrimitiveUP(), can i draw multiple fan or am I limited to one fan per DrawPrimitiveUP?

Share this post


Link to post
Share on other sites
I''ve done this myself so I have an idea about it. Strips won''t help you that much if you want to draw 500 quads in one DP because of the different texture coordinates for each tile. You''re best bet is to use triangle lists. Use an index buffer so you save on 2 verts. You won''t have to worry about a performance hit if all your tiles are in one texture (I have all my 16x16 tiles in one 512x512 texture). Also if all you''re tiles don''t fit into just one try to group them someway (I matched tiles into a forest texture, a town texture, a snow texture, etc).

Share this post


Link to post
Share on other sites
First of all, if you''re using DrawPrimativeUP, then performance probably isn''t your main concern. Most people only use UP for quick tests/hacks but not for all rendering. Now, 500 calls to DrawPrimative per frame doesn''t sound too bad if that''s for rendering your whole scene. Modern CPU''s/GPU''s are fast enough to handle this kind of driver abuse. If it''s all static, you''re better off using a vertex buffer though.

Share this post


Link to post
Share on other sites
~25000 DIP calls per second = 100% CPU USAGE on a 1 ghz machine. Assuming 100 frames per second (which is modest if you are just doing 2d with 3d), that is 250 calls per frame. Add on collision detection, ai, etc... You should make it one call if at all possible.

Share this post


Link to post
Share on other sites
OK, i see this alot, so I gotta ask.
Someone mentioned that if it''s static then the best bet would be the use of vertex buffers.

Is this opposed to the use of index buffers?

What if the scene if not static, meaning there is LOD management going on, so at one point there might be more vertices in a forest scene, and in another moment, there might be less vertices in the same scene. Since this is anything but static, would vertex buffers be a bad thing in particular or just an unconventional way?

I plan on using vertex buffers for my dynamic scene. then if need be, index buffers.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!