Jump to content
  • Advertisement
Sign in to follow this  
streamer

ID3DXSprite performance question

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

Hi all. So many times when I render a lot of different sprites I use same ID3DXSprite with other textures. Like ... pSprite->Draw(pTex1,0,0,&vPos,0xffffffff); ... and few code lines after I use same pSprite with another texture: ... pSprite->Draw(pTex4,0,0,&vPos,0xffffffff); ... Is there any performance drawback with this aproach? I mean when I want to use a sprite with different texture I must anyway change current texture so teoreticly it is just the same. Am I right?

Share this post


Link to post
Share on other sites
Advertisement
Yes. You should only have one ID3DXSprite in your application, and you should use ID3DXSprite::Begin() to batch by texture changes (unless you batch by texture in your app already).
ID3DXSprite is about as efficient as you can make it, but there are some features that are lacking (Which is one reason why a lot of people implement their own version).

Share this post


Link to post
Share on other sites
Thank you steve. Why should I have only ONE ID3DXSprite in my application? Is there any slowdown between two or more different ID3DXSprite-s calls?

Share this post


Link to post
Share on other sites
Each ID3DXSprite manages it's own internal vertex buffer (And possibly index buffer, I'm not sure). So having two objects means D3DX will have to do a VB switch behind the scenes. And you don't actually need more than one ID3DXSprite; it behaves more like a singleton than a wrapper for a sprite object.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!