Sign in to follow this  
madiyaan

Modifying textures on-the-fly

Recommended Posts

Hello, I am looking for a tutorial or guide or any kind of information for that matter that will make me enable writing to the textures runtime. I want to have effects like bullet-holes etc. on my textures and re-render them during runtime. Can anyone please provide me with some pointers? :) Thank you,

Share this post


Link to post
Share on other sites
You would use the functions "GetSurfaceLevel(), SetRenderTarget()" to draw on the texture, and "GetBackBuffer(), SetRenderTarget()" to restore the backbuffer as the render target.

Share this post


Link to post
Share on other sites
Writing to (modifying) textures at runtime seems like a bad idea in your particular case. Depending on which pool your texture is placed, this could be a slow operation. As the poster above has suggested, try googling for decals.

Share this post


Link to post
Share on other sites
Or, if decals really don't fit what you want then look into render-targets.

Manually locking a texture and writing to it is probably one of the best ways to get your code to run as slowly as possible.

Share this post


Link to post
Share on other sites

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