Hi All. It is silent on the AnswerHub so I will try here.
I am creating a data (not pixels) texture in runtime.
I have two questions regarding this:
-
How do I access the native RHI texture? Here is how I do it now,but Resource->GetTexture2DRHI(); returned NULL.
myTexture = UTexture2D::CreateTransient(TextureWidth, TextureHeight,EPixelFormat::PF_R16G16B16A16_SNORM); if (myTexture ) { // no compression. myTexture ->CompressionSettings = TextureCompressionSettings::TC_EditorIcon; myTexture ->SRGB = 0; myTexture ->MipGenSettings = TextureMipGenSettings::TMGS_NoMipmaps; myTexture ->UpdateResource(); } FUpdateTextureRegion2D texRegion = { 0, 0, 0, 0,(unsigned) TextureWidth,(unsigned)TextureHeight }; UpdateTextureRegion(myTexture , 0, texRegion, myTexture ->GetSurfaceWidth() * (64), 64, (uint8*)TextureData, false); //HERE GETTING NULL auto tex2dRHI = CurveTexture->Resource->GetTexture2DRHI();
-
I want to be sure I pick up correct pixel format.
In OpenGL those are:
Texture 1 : GL_RGBA16F
,GL_HALF_FLOAT
Texture 2: GL_RGBA16UI
, GL_UNSIGNED_SHORT
In UE4 EPixelFormat
enum I found PF_R16G16B16A16_SNORM
and PF_R16G16B16A16_UINT
Are those equivalent to the above GL types?
Thanks!