# How to get Render target handle in Unreal (OpenGL)?

**URL:** <https://forums.unrealengine.com/t/how-to-get-render-target-handle-in-unreal-opengl/1733788>\
**Category:** Getting Started & Setup\
**Tags:** opengl, unreal-engine, render-target, CPP, question\
**Created:** [March 6, 2024, 1:02pm UTC](https://forums.unrealengine.com/t/how-to-get-render-target-handle-in-unreal-opengl/1733788 "2024-03-06T13:02:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DennisDYWu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DennisDYWu](https://forums.unrealengine.com/u/DennisDYWu)\
**Post date:** [March 6, 2024, 1:02pm UTC](https://forums.unrealengine.com/t/how-to-get-render-target-handle-in-unreal-opengl/1733788/1 "2024-03-06T13:02:32Z")

</div>

Hi,

I need some help.

(Windows 10, UE 4.22, OpenGL, Nvidia RTX A4000)  
Is there any method let me to get the handle(pointer) of render texture?  
I need to feed this handle to opencl to do some caculation.

In Unity, I could get texture handle easily like below:

RT = new RenderTexture(frameWidth, frameHeight, 24);  
RT.format = RenderTextureFormat.DefaultHDR;  
RT.Create();  
handle = RT.GetNativeTexturePtr() \<— I need this in unreal

Is there any solution?

---

<div class="post-metadata">

**Author:** ![Alexan-Noctis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Alexan-Noctis](https://forums.unrealengine.com/u/Alexan-Noctis)\
**Post date:** [April 24, 2024, 3:10am UTC](https://forums.unrealengine.com/t/how-to-get-render-target-handle-in-unreal-opengl/1733788/2 "2024-04-24T03:10:16Z")

</div>

Bumping this thread.

Did you ever get an answer or find a solution?

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [April 24, 2024, 9:11am UTC](https://forums.unrealengine.com/t/how-to-get-render-target-handle-in-unreal-opengl/1733788/3 "2024-04-24T09:11:36Z")

</div>

I’m guessing you could use MyRenderTexture-\>GetNativeResource()-\>GetNativeHandle()

> **[FRHITexture::GetNativeResource](https://docs.unrealengine.com/4.27/en-US/API/Runtime/RHI/FRHITexture/GetNativeResource/)**
>
> Returns access to the platform-specific native resource pointer.

Look through the engine source to get examples closest to what you want to achieve.  
It’s a pretty unsafe operation though because the return value is unknown

Here is an example from GoogleARCoreApi.cpp

```auto
ArTrackable* TrackableHandle = reinterpret_cast<FGoogleARCoreTrackableResource*>(TrackedGeometry->GetNativeResource())->GetNativeHandle();

```

If you sift through the engine code you might find one directly for render to texture.
