/api/media/file/TryingToForceOpenGLRHI

// blog

Enable OpenGL, and disable Vulkan, in Unreal Engine 4.25

Can't support Vulkan?

Tired of typing -opengl4 every time you want to open UE4.25?

Don't want to edit -opengl4 into the generated desktop files so you can launch it without the terminal?

Want to launch directly from the project?

You're in luck! There's a very simple way to enable OpenGL while disabling Vulkan.

Chances are, you're here because you're getting the error message;

Trying to force OpenGL RHI but the project does not have it in TargetedRHIs list.

bash

So how do I enable OpenGL?

You just need to uncomment one line in the BaseEngine.ini file located here:

Engine/Config/BaseEngine.ini

bash

Then search for, and uncomment the line

+TargetedRHIs=GLSL_430

plaintext

At the time of me writing this, this can be found on line 2191.

You'll now be able to launch Unreal by using the -opengl4 argument. But what if you don't want to include the argument? That's simple! You just comment this line above it:

+TargetedRHIs=SF_VULKAN_SM5

plaintext

As the comment directly above it states:

When neither -vulkan nor -opengl4 are passed on the command line, the engine will default to the first targeted RHI.

By default, the first targeted RHI is Vulkan.

After the edits, the Linux Target Settings in your BaseEngine.ini should look like this:

[/Script/LinuxTargetPlatform.LinuxTargetSettings]
; When neither -vulkan nor -opengl4 are passed on the commandline, the engine will default to the first targeted RHI.
; +TargetedRHIs=SF_VULKAN_SM5

; OpenGL4 is deprecated, you can comment this back in to add it to your targeted RHI list
+TargetedRHIs=GLSL_430

plaintext

Congrats! Unreal can now be launched without the -opengl4 argument.

You will see a new warning message every time you launch. Just click "Ok", and Unreal will continue launching. It may be worth getting a new computer soon, though, as I doubt UE5 will support OpenGL.

// Did this help?

I build things, write about them, and share what I learn. If any of it's been useful to you, a coffee goes a long way.
Buy me a coffee ☕