Sign in to follow this  

ID3DXSprite performance question

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

This topic is 4200 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.

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