Jump to content
  • Advertisement
Sign in to follow this  
Stormtrooper

How many Direct3D Sprites?

This topic is 3803 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

I know to speed up drawing of sprites, you should use one Direct3D sprite and call multiple sprite.draw functions for each sprite. How many Direct3D sprites should I have? Should I have one for everything, or have one for the tile map, one for the UI, one for the text, etc? Or does it not matter?

Share this post


Link to post
Share on other sites
Advertisement
One for everything. You get no benefit whatsoever for having more than one.

Share this post


Link to post
Share on other sites
I saw the post and just thought I'd ask. Where can I find a good tutorial on Direct3D Sprites. It sounds like something I'd like to try.

Thanks
boolean010

Share this post


Link to post
Share on other sites
Quote:
Original post by boolean010
I saw the post and just thought I'd ask. Where can I find a good tutorial on Direct3D Sprites. It sounds like something I'd like to try.

Thanks
boolean010


search the articles here.

as for the OP, I'm assumming you're talking about texture atlasing, in wich case more you combine onto one sheet the better aslong as the texture size doesn't get to big and slow your card down. Also if you're doing alot of switchs between dhaders and render states, atlasing isn't going to help as much as you will probably be making less use of it.

but your question isn't that clear, so i might just sound like i was rambling.

Share this post


Link to post
Share on other sites
Quote:
Original post by Tom
One for everything. You get no benefit whatsoever for having more than one.

That's not always the best choice. There are quite common scenarios when having more than one Sprite comes in handy. Specifically, if you're rendering some objects with Alphablending enabled, and some with it disabled, you'd want one per type. You can call begin on both, queue up the draws as you go, and then call end on both (on the opaque one first, most likely).

If you only use one Sprite, you'd need to either go through all the opaque objects first, then render the blended ones, or you could draw all objects with alphablending. Both options are inefficient.

I'd recommend using one Sprite per type of drawing. If some objects require a certain set of states, and others require a different set of states, they should use different Sprites.

Hope this helps.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!