Sign in to follow this  

Copy Texture2D

This topic is 1969 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

Im currently trying to make part of one Texture onto another. I think it has something to do with GetData but I cant figure out how to make it work.

The basic idea is I want to make a texture become a certain rectangle of another texture. Any help would be appreciated.

Share this post


Link to post
Share on other sites
I'd use SpriteBatch to render your first Texture2D onto a new RenderTarget, render your clipped second Texture2D on top, then cast the RenderTarget onto a final Texture2D which will be the combination of the two original textures.

Share this post


Link to post
Share on other sites
[quote name='PhillipHamlyn' timestamp='1343150850' post='4962668']
I'd use SpriteBatch to render your first Texture2D onto a new RenderTarget, render your clipped second Texture2D on top, then cast the RenderTarget onto a final Texture2D which will be the combination of the two original textures.
[/quote]
I have to admit I dont really understand what are you saying. Could you explain it in a bit more detail.

Share this post


Link to post
Share on other sites
[quote name='walsh06' timestamp='1343477471' post='4963923']
[quote name='PhillipHamlyn' timestamp='1343150850' post='4962668']
I'd use SpriteBatch to render your first Texture2D onto a new RenderTarget, render your clipped second Texture2D on top, then cast the RenderTarget onto a final Texture2D which will be the combination of the two original textures.
[/quote]
I have to admit I dont really understand what are you saying. Could you explain it in a bit more detail.
[/quote]
Just look at ATEFred's suggestion! Here is the MSDN-page for what he suggested.

http://msdn.microsoft.com/en-us/library/windows/desktop/ff476394%28v=vs.85%29.aspx

Share this post


Link to post
Share on other sites
But he said that the rectangle has to stay the same. I assumed that means the texture2D cant change location. Am I wrong in thinking that??

Share this post


Link to post
Share on other sites
Oh ok, So with my code Im displaying the Texture and then I want a 100x200 square to be copied to a new texture. This is determined by where the user clicks. So how do i implement the click into it.

Share this post


Link to post
Share on other sites
Well, that's a completely different question. DirectInput is deprecated after DirectX 8, but it's still works well for normal keyboard and mouse operations. I'd recommend you to take a look at Rasterteks DirectInput tutorial.

There is also XInput, which is supposed to replace DirectInput, but as far as I know, it can't handle mice devices.

Share this post


Link to post
Share on other sites
well basically I was creating a rectangle around their click and I want to copy the texture thats inside that rectangle. So do I have to do something different??

Share this post


Link to post
Share on other sites

This topic is 1969 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.

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