Quick answer: “LoadLibrary failed with error 87” (also 126 and 1114) appears when Windows cannot load the graphics vendor’s OpenGL driver for your game. It affects OpenGL games only and is almost always a driver problem on the player’s PC: mismatched drivers on a switchable-graphics laptop, a Remote Desktop session, or a damaged install. Players fix it by installing the vendor’s drivers and running locally on the high-performance GPU; you can avoid it by offering a Direct3D, Vulkan or ANGLE renderer.
Your game does not contain the words “LoadLibrary failed”, and neither does your engine. The dialog comes from the graphics driver, at the moment your game asks Windows for an OpenGL context, and it looks identical in a Java game, a Blender install and yours. That is useful to know before you spend an evening searching your own code. This guide explains the loading chain that fails, which engines are exposed to it, the three situations behind nearly every report, what you can change in the game so fewer players meet it, and an ordered reply for the ones who do.
- The exact error
- Where the dialog comes from
- Which games are exposed
- What triggers it
- How to tell which one it is
- Fix 1: offer a renderer that does not need the OpenGL driver
- Fix 2: detect the situation and say something useful
- Fix 3: put OpenGL in the requirements
- What to tell players
- How to confirm the fix
- What Bugnet can report here
- Related guides
- Frequently asked questions
The exact error
LoadLibrary failed with error 87: The parameter is incorrect.
LoadLibrary failed with error 126: The specified module could not be found.
LoadLibrary failed with error 1114: A dynamic link library (DLL) initialization routine failed.
The numbers are ordinary Win32 error codes: 87 is ERROR_INVALID_PARAMETER, 126 is ERROR_MOD_NOT_FOUND and 1114 is ERROR_DLL_INIT_FAILED. The dialog appears as the window is being created, before the first frame. After the player clicks OK the game usually closes, or reports that it could not create an OpenGL context.
Where the dialog comes from
OpenGL on Windows is split in two. opengl32.dll, which ships with Windows, is a thin front end. The implementation is the GPU vendor’s installable client driver (ICD), a DLL registered by the display driver package: nvoglv64.dll for NVIDIA, atio6axx.dll for AMD, and an Intel file whose name changes with the GPU generation. When a program sets up its first OpenGL context, Windows loads the registered ICD into the process.
On laptops with AMD switchable graphics there is one more link: a small AMD component, atig6pxx.dll, sits in front and decides which GPU’s driver to load. The dialog is what you see when a load in this chain fails. In public reports it is tied overwhelmingly to AMD Radeon drivers.
Direct3D and Vulkan do not go through this path. Direct3D drivers are loaded by the DirectX runtime, and Vulkan has its own loader and driver registration. A Direct3D or Vulkan build of the same game on the same PC starts normally, which is the basis of the developer-side fix. One caveat: a Direct3D game with a launcher or tool built on an OpenGL toolkit can still show the dialog, from the launcher.
Which games are exposed
| Engine or framework | Uses OpenGL on Windows | Alternative you can offer |
|---|---|---|
| Godot 4, Compatibility renderer | Yes | ANGLE fallback (built in), or the Forward+ and Mobile renderers on Vulkan or Direct3D 12 |
| Godot 3 | Yes | None built in |
| Ren’Py | Yes, by default | Its ANGLE renderer, chosen from the Graphics Acceleration menu (Shift+G) |
| Pygame and other SDL programs | Only if you request an OpenGL context | A plain 2D Pygame window does not need OpenGL |
| LÖVE 11, raylib, SFML | Yes | None built in |
| MonoGame DesktopGL | Yes | The WindowsDX target (Direct3D 11) |
| Java games on LWJGL, including libGDX | Yes | libGDX has an optional ANGLE extension for its LWJGL 3 backend; check its current status |
| Unity, Unreal, GameMaker | No, Direct3D by default | Not affected unless you chose or forced OpenGL |
If your engine is not listed, look at its renderer options. The question to answer is whether the Windows build can start without loading the vendor’s OpenGL driver.
What triggers it
- A switchable-graphics laptop with mismatched Intel and AMD drivers. The classic source of error 87 and of 1114. The integrated and dedicated drivers are meant to be installed as a matched pair. Windows Update refreshes one, or the player installs a generic package over the laptop maker’s, and the component that hands OpenGL to one GPU or the other can no longer load its target.
- A Remote Desktop session. The usual story behind error 126 on a desktop PC with a Radeon card. The session does not expose the real GPU in the normal way and the driver’s OpenGL DLL fails to load. The same game starts when the player sits at the machine.
- A driver from Windows Update, or a broken driver update. Drivers that Windows installs on its own are sometimes cut-down packages, and an interrupted update can leave the Direct3D part working while the OpenGL files are missing or stale. Direct3D games run, so the player is certain the PC is fine.
- A virtual machine. Less common for this exact dialog. A VM without 3D acceleration more often ends in a plain context-creation failure, covered in failed to create OpenGL context.
None of these is a defect in your build. What you control is whether the game depends on OpenGL at all, and how clearly it explains itself when OpenGL is unavailable.
How to tell which one it is
Four questions settle most threads:
- Which number? 87 and 1114 point at switchable graphics. 126 points at a remote session or an incomplete driver install.
- Laptop or desktop, and which GPUs? A DxDiag report lists every adapter with its driver date; two adapters with driver dates years apart is the mismatch. See what to look for in a DxDiag report.
- Are you connected to the PC remotely? Players rarely mention it unless asked.
- Does any other OpenGL program start? If another OpenGL application shows the same dialog, the PC is at fault and no patch from you will change it.
Fix 1: offer a renderer that does not need the OpenGL driver
ANGLE translates OpenGL ES calls to Direct3D 11, so the vendor’s OpenGL driver is never loaded. Where your engine has it, this is the cheapest fix.
In Godot 4’s Compatibility renderer, two project settings matter. rendering/gl_compatibility/fallback_to_angle is on by default and switches to ANGLE when native OpenGL is unsupported, and rendering/gl_compatibility/driver.windows can be set to opengl3_angle to use ANGLE on Windows from the start. Forcing it costs some performance, so the fallback is the better default. Players can try it per launch:
MyGame.exe --rendering-driver opengl3_angle
If the project does not need to run on very old GPUs, the Forward+ and Mobile renderers avoid OpenGL entirely. For engines with no alternative backend (LÖVE 11, Godot 3, raylib), the honest position is that the fix is on the player’s side, and the next two sections are what you have.
Fix 2: detect the situation and say something useful
You cannot intercept the driver’s dialog, but you can get ahead of it. A remote session is detectable before any window exists with one Win32 call, GetSystemMetrics(SM_REMOTESESSION). In a Python game:
import ctypes
import sys
SM_REMOTESESSION = 0x1000
MB_ICONWARNING = 0x30
def warn_if_remote_session():
if sys.platform != "win32":
return
user32 = ctypes.windll.user32
if user32.GetSystemMetrics(SM_REMOTESESSION) != 0:
user32.MessageBoxW(
None,
"This game renders with OpenGL, which may be unavailable "
"over Remote Desktop.\n\nIf the next step fails, start the "
"game while sitting at this PC.",
"MyGame",
MB_ICONWARNING,
)
warn_if_remote_session() # call before creating the display
The same call works from C, C++, C# or anything else that can reach user32.dll. After a context is created, read the renderer string as well. A value of GDI Generic from glGetString(GL_RENDERER) means Windows fell back to its software OpenGL 1.1 because no vendor driver loaded, and the game should stop with a message that names the driver as the problem instead of failing later on a missing extension.
A native executable can also ask hybrid laptops for the dedicated GPU by exporting two documented symbols. They must be exported from the .exe itself, so this is not available to games launched through python.exe or javaw.exe:
extern "C" {
__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
Fix 3: put OpenGL in the requirements
State the OpenGL version the game needs on the store page, next to the GPU, and add a line that drivers must come from the GPU manufacturer. A player whose Direct3D games all work has no reason to suspect the driver until the page tells them this game uses a different part of it.
What to tell players
- Start the game while sitting at the PC, not through Remote Desktop.
- Install current graphics drivers from the manufacturer. On a laptop with two GPUs, install both the integrated and the dedicated driver, ideally the matched package from the laptop maker or AMD’s current one, then restart.
- Set the game to the high-performance GPU: Settings > System > Display > Graphics, add the game’s executable, choose High performance.
- For error 1114 on a laptop, open the advanced settings of the active power plan and, if there is a Switchable Dynamic Graphics entry, set it to Maximize performance.
- If the game offers another renderer or a launch option for one, use it.
- Last resort, AMD switchable graphics only: the widely repeated workaround is to rename
atig6pxx.dllinC:\Windows\System32toatig6pxx.dll.bak. It needs administrator rights, it edits a driver install by hand, it can leave OpenGL programs on the integrated GPU, and the next driver update undoes it. A clean reinstall of both drivers is the better fix. Offer this only after steps 1 to 5 fail, and say what it does.
How to confirm the fix
Force the alternative renderer on a healthy machine and check that the game runs on it: with Godot, launch with the ANGLE driver and read the first lines of output, which name the renderer in use. If you own a PC with a Radeon card, connect to it with Remote Desktop and start the game; that reproduces the 126 case better than any description, and shows whether your warning appears first. Then ask one affected player to try the build before you announce it. A driver fault on someone else’s laptop is not something a clean test machine will show you.
What Bugnet can report here
A game that never starts cannot report itself, and in most engines scripts begin only after the renderer exists, so this dialog produces no automatic report. Pygame is the exception: your Python code runs before the window does. With bugnet_sdk.init() called first, an uncaught exception from the failed display setup is filed by the Pygame SDK‘s exception hook with the traceback and system details, and your own check can call report_error() to record a software-renderer fallback. Everywhere else, Bugnet contributes two things: the GPU on every report from players who do get in, which shows how many of your players are on Radeon or integrated graphics, and a known-issue entry on your public tracker titled with the dialog text and carrying the steps above.
Related guides
- How to Fix “Failed to create OpenGL context” Errors for Your Game’s Players
- How to Fix Your Game Running on the Wrong GPU (Integrated Instead of Dedicated)
- How to Ask Players for a DxDiag Report and What to Look For in It
- How to Fix “Failed to initialize graphics” (InitializeEngineGraphics failed) in Unity Games
- How to Debug GPU Driver-Specific Rendering Bugs
Frequently asked questions
What does LoadLibrary failed with error 87 mean?
Windows could not load the graphics vendor’s OpenGL driver into the program. Error 87 is most often seen on laptops with AMD switchable graphics where the integrated and dedicated drivers do not match. Installing a matched, current driver set from the manufacturer normally fixes it.
What is the difference between error 87, error 126 and error 1114?
They are Windows error codes for the same failed driver load. 87 means an invalid parameter and points at switchable graphics. 126 means the driver module was not found, common over Remote Desktop or after an incomplete driver install. 1114 means the driver DLL failed to initialize.
Why do other games work when mine shows LoadLibrary failed?
Most commercial games render with Direct3D or Vulkan, which load their drivers through a different path. This error only affects programs that use OpenGL. A PC can run Direct3D games perfectly while its OpenGL driver is missing or broken.
Is it safe to rename atig6pxx.dll?
It is a workaround that edits the graphics driver install by hand. It often lets OpenGL programs start on AMD switchable graphics laptops, but it can leave them on the integrated GPU and a driver update restores the file. Reinstalling both graphics drivers cleanly is the better fix.
Can I fix this error in my game’s code?
Not directly, because the dialog comes from the driver. You can avoid it by offering a Direct3D, Vulkan or ANGLE renderer, and you can detect a Remote Desktop session or a software OpenGL fallback at startup and show a message that tells the player what to change.
The string “LoadLibrary failed” is the graphics driver talking, so the only code fix is not needing that driver: ship an ANGLE, Direct3D or Vulkan path if your engine has one, and a clear message if it does not.