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

Function

dxDrawMaterialPrimitive3D

ClientDrawing (dx)Identical to MTA:SA

Draws a triangle shape in the 3D world covered with a material. Vertices are {x, y, z, color, u, v}, where u and v (0-1) tell which image point lands on the vertex. The colour of the whole shape comes from the first vertex.

Syntax

bool dxDrawMaterialPrimitive3D(string primitiveType, string|element material, bool postGUI, table vertex1 [, table ...])

Arguments

primitiveTypestring
"trianglelist", "trianglestrip", "trianglefan".
materialstring|element
The material.
postGUIbool
For compatibility with existing scripts.
vertex1table
{x, y, z, color, u, v}.
...table, optional
More vertices.

Returns

true if drawn.

Example

An image on a flat square (e.g. a logo on the ground).

addEventHandler("onClientRender", root, function()
    local c, z = tocolor(255, 255, 255), 13.6
    dxDrawMaterialPrimitive3D("trianglestrip", "img/logo.png", false,
        { 2490, -1680, z, c, 0, 0 }, { 2500, -1680, z, c, 1, 0 },
        { 2490, -1690, z, c, 0, 1 }, { 2500, -1690, z, c, 1, 1 })
end)

See also