Sign in to follow this  
jesperhw

[D3D9 C++] Copying transparent tiles from one texture to another?

Recommended Posts

I'm developing a strategy game with a tile-based world map. I have all the terrain tiles loaded as a texture because some of the tiles are transparent (to be rendered on top of the ordinary terrain tiles). Now I need to populate a world map with these tiles by saving it all in another texture. So the question is, how do I copy the terrain tiles from the first texture into the world map texture? Can't use plain surfaces, as I am using transparent tiles. Any suggestions?

Share this post


Link to post
Share on other sites
[quote name='jhw75' timestamp='1318237262' post='4871013']
I'm developing a strategy game with a tile-based world map. I have all the terrain tiles loaded as a texture because some of the tiles are transparent (to be rendered on top of the ordinary terrain tiles). Now I need to populate a world map with these tiles by saving it all in another texture. So the question is, how do I copy the terrain tiles from the first texture into the world map texture? Can't use plain surfaces, as I am using transparent tiles. Any suggestions?
[/quote]

Render the whole map into an offscreen target and then use that target as the texture for what ever you need it, this is what render targets are for and you are not doing any weird copying on the fly. You want to avoid copying surfaces from one place to another anyway as you probably need a GPU readback which are bad and should be avoided.


You need to render two scenes for this to work by the way, so one for the filling screen quad(or array of quads) and then another in which you do the normal rendering of your normal scene. In this second render pass you can use the previously used render target as a normal texture.

Share this post


Link to post
Share on other sites

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