ID3DXSprite performance question
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?
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).
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).
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?
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement