Archived

This topic is now archived and is closed to further replies.

PDIRECT3DTEXTURE9 Efficient Use of Same Texture Repatedly?

This topic is 5015 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 folks! I''m working with PDIRECT3DTEXTURE9 textures derived from bitmap resources. One series of textures I''m using are animation frames for an explosion. In my game, there will be times when those explosion frames are used for both a cannon shell''s impact and the destruction of it''s target. So my question is, what''s the most efficient way to store these textures? Should I store the explosion seperately as it''s own entity and draw it twice, replacing the other two sprites? Or does it matter? Since the textures are coming from resources and the PDIRECT3DTEXTURE9 is just a pointer, is there really any reason not to let each sprite have it''s own set of textures derived from this set of bitmaps? In fact, aside from this, how do you think it will look? I mean, I''ve thought that maybe having both the shell and the target explode in two seperate but simultaneous explosions might look silly. Perhaps if I have seperate animation sequences for the target''s explosion? But there are two potential targets, so I suppose it''s still a valid question. Should I create my textures independent of the sprites and just have them all share them? Or should each sprite have it''s own "copy" of the explosion textures in the form of PDIRECT3DTEXTURE9''s? Rattlehead

Share this post


Link to post
Share on other sites
As far as each entity having its own copy of the textures it uses, that''s a bad idea. You should have some kind of TextureManager that stores all the textures only once and makes sure that it releases them when they aren''t needed. The TextureManager could associate some kind of ID with each texture. Then each of your entities could use this ID to access the texture for rendering.

About using the same explosion for both the cannon ball hitting an object and the explosion caused, well that''s up to you. Maybe you could create a seperate explosion animation that its a little bigger that you play when two objects that normally explode on their own collide. Cuz it makes sense that if two objects explode on their own, then when they smash into each other, you''d get a bigger explosion.

Another idea could be to play your explosion sequence in a slightly different order. Maybe reverese the order of the animation for the cannon ball or something. Just an idea.

neneboricua

Share this post


Link to post
Share on other sites
Ok, a texture manager sounds like a good idea. I guess I could use the Resource IDs to track them since they''re all reasources rather than created directly from files.

Any good tutorials on creating a texture manager out there?

As far as the explosions are concerned, I''ve decided to go with a different animation for the cannonball explosion. It''s smaller and looks different enough.

Rattlehead

Share this post


Link to post
Share on other sites