TextureRenderTarget2D drawing functions in C++?

After looking around the web, I can’t really find very much info about how to perform some of the drawing functions in C++. In Blueprints the functions are easily performed onto a TextureRenderTarget2D with the “Clear Render Target” and “Draw Material to Render Target” nodes.

Checking the unreal code that is behind these blueprint nodes the functions seem to be blueprint only.

Any ideas how to perform the standard TextureRenderTarget2D functions purely in C++?

Thanks.

They’re in the UKismetRenderingLibrary
https://api.unrealengine.com/INT/API/Runtime/Engine/Kismet/UKismetRenderingLibrary/index.html

Thank you for suggesting that. I was under the impression that because it was marked as a Blueprint Function Library that it could not be used directly in C++ and I also read a post by someone else that said we (developers) should not use the Kismet libraries if they are marked with “MinimalAPI” in the UCLASS?

After running a small test to create the texture render target 2D it does work using:

UTextureRenderTarget2D* mytexture = UKismetRenderingLibrary::CreateRenderTarget2D(this, 512, 512, RTF_R8);

That just means it is a subclass of UBlueprintFunctionLibrary, which means that it will only contain static methods (1). Also, the macros UCLASS() and GENERATED_UCLASS_BODY() are part of the reflection system that expose it to blueprints (2). Could you share a link to the post that says not to use classes marked with MinimalAPI (perhaps they were cautioning about using it in custom classes)? The MinimalAPI specifier is new to me, but from the documentation and this article it just means that other Modules will only need class information, but not the ability to call functions. I think the MinimalAPI specifier speeds up the Reflection process. Also, I found a video explaining how to create a reflection system in C++ that was inspired from Unreal Engine if you’re interested.

Sure, the post was from the Unreal forums here

That post talks about the MINIMAL_API but I am not familiar with either that or MinimalAPI.

Thank you for your insight into this.