Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Is it possible to overlay one texture over another and make them into a new texture? It should also work with an offset.

Here's an example:

This texture

and this texture

should make this texture

It should be possible to change the position of one texture.

share|improve this question
2  
How do you intend to use the "new" texture? I think that makes all the difference in what kind of answer will be useful to you. –  Seth Battin Apr 19 '13 at 15:26
    
It should be ingame possible to change the position of one of the textures and that means I nead a method that combines the 2 textures to a third one but with a offset. –  user1990950 Apr 19 '13 at 15:30
    
Right, but once you have a new texture, what are you going to do with it? If the question is "is possible?", the answer is almost always yes. But that doesn't answer the question "should I?" –  Seth Battin Apr 19 '13 at 16:04
    
There's no other solution. I need to change the texture, so I can attach it to a 3D model. –  user1990950 Apr 19 '13 at 16:12
    
There are nigh-innumerable ways to alter a model's texture. Why don't you elaborate on what you're trying to do, so that people might be able to offer you a different solution? –  Seth Battin Apr 19 '13 at 22:44

1 Answer 1

up vote 0 down vote accepted

I see a couple ways to do this when I first think of it. Here's how I would take my first stab at it.

  1. Create a RenderTarget that you can draw to. (Make it the size of the "base texture")
  2. Draw your base texture on the RenderTarget so it fills it up.
  3. Draw onto the RenderTarget again if needed; you can use SourceRectangle and DestinationRectangle on the SpriteBatch overload to accomplish this.
  4. You can then save or use this texture inside your game.

Seems simple enough.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.