- Documentation
- Client functions
- dxCreateRenderTarget
Function
dxCreateRenderTarget
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 = falsetrue= 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
dxSetRenderTargetSets where thedxDraw*functions draw: on a render target (optionally clearing it first) or, without an argument, on the screen. It only works inonClientRenderandonClientPreRender; after the event drawing goes back to the screen.dxDrawImageDraws an image (a resource PNG/JPG file, a texture, a render target, a browser or a camera) in a screen rectangle, with optional rotation and tint.