Skip to main content
TRACK B·INTERFACES (NUI)·Verified June 2026 · Lua 5.4 · ox_lib 3.x
Learning with an AI assistant?
Copies this lesson plus 2026 ground rules (no lua54 'yes', Cfx.re Portal, correct callback signatures) as a ready-to-paste mentor prompt.

DUI: render live HTML on 3D surfaces

Full-screen NUI paints a webpage over the whole screen. DUI paints a webpage onto a single GTA texture instead, so the page becomes a surface in the world: a TV, a billboard, an advert, a dashboard. The browser is the same one NUI uses. The only thing that changes is where the pixels land. This lesson builds the smallest honest DUI: a live HTML clock that replaces a prop's texture so it ticks in the world, then takes the native chain apart so you can point it at any texture you like.

You'll build
A resource that renders a live HTML clock onto an in-world texture, so a billboard prop shows a webpage you control instead of its baked GTA texture.
Time
~28 minutes
You need
The NUI lessons done. You should already know SetNuiFocus, SendNUIMessage, RegisterNUICallback, and the difference between callback and resource-file URLs. DUI reuses the web stack, pointed at a texture instead of the screen.
You'll learn
What DUI is and how it differs from full-screen NUI -> the native chain CreateDui -> GetDuiHandle -> CreateRuntimeTxd -> CreateRuntimeTextureFromDuiHandle -> AddReplaceTexture -> how to push updates with SendDuiMessage, swap pages with SetDuiUrl, and clean up with DestroyDui
BEFORE YOU START

DUI vs NUI: pick the right tool

Both use the same embedded Chromium browser the runtime ships with. The difference is the render target.

  • NUI renders your page to a full-screen layer over the game. You reach for it when the UI is something the player looks at and interacts with directly: menus, HUDs, inventories, phones, dialogs. Input flows through SetNuiFocus and RegisterNUICallback.
  • DUI renders your page to an offscreen texture you then paint onto game geometry. You reach for it when the UI lives in the world: an in-world TV, a digital billboard, a stadium screen, a slot machine display, an advert board, a gas-station price sign. A DUI surface has no cursor and no direct click input. It is pixels on a polygon. You drive it one way, from Lua, with SendDuiMessage.

The quick test: if the player needs to move a mouse over it, that is NUI. If it is something they walk past and see, that is DUI.

Keep reading the full lesson

Sign in to start, then unlock every step of this lesson and the full FiveM School with a membership.

Still ahead in this lesson
  • Build it
  • How it works
  • Common mistakes
  • What you can do now
  • Try it yourself

The remainder of DUI: render HTML on 3D surfaces is available to FiveM School members.