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

Started by
0 comments, last by NightCreature83 12 years, 6 months ago
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?
Advertisement

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?


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.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

This topic is closed to new replies.

Advertisement