# ViewportRHI not working

**URL:** <https://forums.unrealengine.com/t/viewportrhi-not-working/1754065>\
**Category:** Rendering\
**Tags:** rhi, unreal-engine, CPP, question\
**Created:** [March 15, 2024, 2:55pm UTC](https://forums.unrealengine.com/t/viewportrhi-not-working/1754065 "2024-03-15T14:55:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanielSalguero](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DanielSalguero](https://forums.unrealengine.com/u/DanielSalguero)\
**Post date:** [March 15, 2024, 2:55pm UTC](https://forums.unrealengine.com/t/viewportrhi-not-working/1754065/1 "2024-03-15T14:55:46Z")

</div>

Hello everyone. I have been working on a new project for a few days and I need to get a frame directly from the backbuffer. From what I have been researching, this can be done with RHI by simply using the viewport.

The problem I have arises in the following lines of code:  
_FViewport_\* _Viewport = GEngine-\>GameViewport-\>Viewport;_  
_TRefCountPtr MyViewportRHI = Viewport-\>GetViewportRHI();_

More specifically, the second line of code does not get the ViewportRHI since it always returns null. More specifically, I am using these lines in a function that is called every 60 frames from the Tick function. I am making sure that the code is running in the main thread of the game and that it is all initialized correctly.

Can anyone tell me what is going on? I don’t understand why the ViewportRHI is always null.

---

<div class="post-metadata">

**Author:** ![Nick\_Lyrick](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nick\_Lyrick](https://forums.unrealengine.com/u/Nick_Lyrick)\
**Post date:** [June 6, 2024, 3:13pm UTC](https://forums.unrealengine.com/t/viewportrhi-not-working/1754065/2 "2024-06-06T15:13:20Z")

</div>

Same thing for me. I’m trying to get FRHITexture of Viewport and it’s always NULL.  
I’m trying and Game and Render thread
