XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

How to get multiple Texture2D from one Rendertarget, target reuse problem.

Last post 05/11/2009 20:49 by Catalin Zima. 1 replies.
  • 05/11/2009 18:22

    How to get multiple Texture2D from one Rendertarget, target reuse problem.

    In short my problem looks like this:

    I have a heightmap that I use random generated texture on. I have 9 tiles on each map.
    I have a render target that is 2000*2000pix.
    For each tile I draw the texture to the target, I use target.GetTexture2D() to add the texture to a heightmap.
    Problem is when I draw the next tile it also changes the Texture2D for the old tile, making all the tiles look like the same.

    Is there a way to get the Texture2D and lock it somehow from being changed when the target changes? I tried making a new rendertarget for each time I draw a new texture but that did only crash the game.


  • 05/11/2009 20:49 In reply to

    Re: How to get multiple Texture2D from one Rendertarget, target reuse problem.

    Answer
    Reply Quote
    no, you can't reuse a rendertarget the way you want to.
    GetTexture() simply returns a reference to the contents of that rendertarget, not a copy.

    You'll have to try using more rendertargets. Of course, not make a new one each time you render a new texture, but have a set of 9 render targets, and use those.
Page 1 of 1 (2 items) Previous Next