# C++ Edit UTextureRenderTarget2D During Runtime

**URL:** <https://forums.unrealengine.com/t/c-edit-utexturerendertarget2d-during-runtime/421838>\
**Category:** C++\
**Tags:** scenecapturecomponen, unreal-engine, render-target, question, CPP\
**Created:** [April 4, 2018, 8:44pm UTC](https://forums.unrealengine.com/t/c-edit-utexturerendertarget2d-during-runtime/421838 "2018-04-04T20:44:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_fd12200d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_fd12200d](https://forums.unrealengine.com/u/anonymous_user_fd12200d)\
**Post date:** [April 4, 2018, 8:44pm UTC](https://forums.unrealengine.com/t/c-edit-utexturerendertarget2d-during-runtime/421838/1 "2018-04-04T20:44:37Z")

</div>

![236322-image1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/6/e56e3c2cd22b9ed49aa138acc1d3631b061b5075.jpeg)

I have the above code working in blueprint, This takes the UTextureRenderTarget2D of a ASceneCapture2D actor. The scene capture is a Depth-in-R and thus I need to create a new texture with the scaled R comonent. I am unsure how to do this in c++.

Here is the code I use to draw the texture on screen

```
DrawTexture(renderTargets[i], thisX, thisY, sensorViewWidth,
				sensorViewHeight, 0.0f, 0.0f, 1.0f, 1.0f, FColor::White, EBlendMode::BLEND_Opaque);

```
