Ahmed Mohamed
Ahmed Mohamed

Reputation: 413

XNA 4.0 equivalent of RenderTarget2D.GetTexture()?

I'm currently working on a game and I'm trying to implement a color key collision. I followed the road not taken tutorial, and worked until the point of getting the texture from the render target, which is unavailable in XNA 4 and I don't seem to find an equivalent? Any help :D

Thanks in advance !!

Upvotes: 2

Views: 3159

Answers (1)

Jacco Krijnen
Jacco Krijnen

Reputation: 367

In XNA 4.0 the RenderTarget2D class inherits from Texture2D, which means that you can simply cast your render target to a texture:

Texture2D texture = (Texture2D)renderTarget;

Upvotes: 8

Related Questions