ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. dxCreateRenderTarget

Function

dxCreateRenderTarget

ClientDrawing (dx)Identical to MTA:SA

Creates an off-screen drawing surface. After dxSetRenderTarget(rt) every dxDraw* draws on it, and then you draw it like a texture. Without an alpha channel every pixel is opaque.

Syntax

element dxCreateRenderTarget(int width, int height [, bool withAlpha = false])

Arguments

widthint
Width.
heightint
Height.
withAlphabool, optional = false
true = with transparency.

Returns

The render target or false.

Example

local rt = dxCreateRenderTarget(300, 100, true)
addEventHandler("onClientRender", root, function()
    dxSetRenderTarget(rt, true)
    dxDrawText("Na powierzchni", 10, 10, 0, 0, tocolor(255, 255, 255), 2)
    dxSetRenderTarget()
    dxDrawImage(50, 500, 300, 100, rt)
end)

See also