M MY Multiplayer: Wiki
Side
Kind

dxDrawMaterialPrimitive

Client

Draws a 2D primitive with an image on the screen for one frame.

bool dxDrawMaterialPrimitive(string primitiveType, texture|dui|string material, bool postGUI, table vertex1, vertex2, ...)

Parameters

NameTypeDescription
primitiveTypestringPrimitive type: pointlist, linelist, linestrip, trianglelist, trianglestrip or trianglefan.
materialtexture|dui|stringThe image (a texture, render target, screen source or dui) or the path of an image file in the resource.
postGUIboolDraw on top of the interface.
vertex1, vertex2, ...tableOne argument per vertex: {x, y, u, v} or {x, y, color, u, v}, the position in pixels and u, v the coordinates in the image.

Returns

true once the drawing is queued. false when the number of vertices does not fit the type (for example, trianglelist needs a multiple of 3). Also false when the image could not be loaded.

Example

local tex = engineCreateTexture("images/panel.png")

addEventHandler("onClientRender", root, function()
    dxDrawMaterialPrimitive("trianglestrip", tex, false,
        { 100, 100, 0, 0 },
        { 300, 100, 1, 0 },
        { 100, 200, 0, 1 },
        { 300, 200, 1, 1 })
end)

See also