DrawTextureSimple does nothing

UTextureRenderTarget2D* preview = mPreviewCam->TextureTarget;
//hud->DrawTextureSimple(preview, 0, 0);
hud->DrawTexture(preview, 0, 0, preview->SizeX, preview->SizeY, 0, 0, 1, 1);

Commented line does not work. So, it wasnt actually that simple…

Compare it to the BP version

29534-draw+texture+simple.txt (3 KB)

I dont understand that log file? What is it supposed to show?
How does this explain why from code DrawTextureSimple does not work?
This is in 4.6.1. Perhaps this bug is known and fixed in 4.7?

Hey simmania-

The documentation for DrawTextureSimple (AHUD::DrawTextureSimple | Unreal Engine Documentation) shows that it takes in a UTexture pointer rather than a UTextureRenderTarget2D pointer. Also, how is hud defined? Depending on how it is defined it may be best to use hud.Draw… rather than hud->Draw…

Cheers

Hi ,

UTextureRenderTarget2D derives from UTexture, so that should be ok.
Furthermore, hud->DrawTexture takes the same type parameter (UTexture) and works correctly.

This was in 4.6.1 btw.

Hud.Draw instead of Hud->Draw, how does that make sense?

I created a custom hud based on AHUD.

#pragma once

#include "GameFramework/HUD.h"
#include "PlayerHUD.generated.h"


UCLASS()
class APlayerHUD : public AHUD
{
	GENERATED_BODY()

	UPROPERTY()
	class AOnScreenConfig* mOnScreenConfig;
	
	
	virtual void DrawHUD() override;
};

Then in cpp.

#include "DomeProjection.h"
#include "PlayerHUD.h"
#include "OnScreenConfig.h"


void APlayerHUD::DrawHUD()
{
	Super::DrawHUD();

	this->DrawTexture(...)
    this->DrawTextureSimple(..)

}

Hi simmania,

It looks like what is happening here is that DrawTextureSimple is drawing the TextureRenderTarget2D, but the TextureRenderTarget2D’s size is erroneously being set to 0 x 0 so nothing is actually visible. I have entered a ticket for this to be investigated further (UE-12404).