Sign in to follow this  

LPD3DXSPRITE usage

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

Hey all, programming student here. We have done some introductory API work, and I am about to begin a project on the side.

What I am wondering is how an average 2D game will use the LPD3DXSPRITE object. Basically, is there one for the entire program that draws everything during my game_run loop, or should each class (ship, bullet, asteroid for example) have their own LPD3DXSPRITE as a member variable?

I am drawn to think that each object should have its own, but then I also think that it could be like the LPDIRECT3D9 object that has only one instantiation.

Any input or useful links are much appreciated.

Share this post


Link to post
Share on other sites
Although you aren't limited to a single instantiation, it's better to use fewer. In many cases you shouldn't even need to use more than one. Think of it as batching. Each ID3DXSprite essentially allows a batch of sprites to be drawn in one go, so using a different ID3DXSprite for every sprite you want to draw negates the performance gains acquired by using the ID3DXSprite interface.

Try to stick to one ID3DXSprite if you can.

Share this post


Link to post
Share on other sites

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