M MY Multiplayer: Wiki
Side
Kind

dxDrawMaterialPrimitive3D

Client

Draws a primitive with an image in the 3D world for one frame.

bool dxDrawMaterialPrimitive3D(string primitiveType, texture|dui|string material, table vertex1, vertex2, ... [, string|bool stage = postfx])

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.
stagestring|boolWhen to draw: prefx, postfx or postgui, or a boolean (true means postgui).default postfx
vertex1, vertex2, ...tableOne argument per vertex: {x, y, z, u, v} or {x, y, z, color, u, v}, the position in the world 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/floor.png")

addEventHandler("onClientRender", root, function()
    dxDrawMaterialPrimitive3D("trianglestrip", tex, "postfx",
        { 2490, -1670, 13.6, 0, 0 },
        { 2494, -1670, 13.6, 1, 0 },
        { 2490, -1666, 13.6, 0, 1 },
        { 2494, -1666, 13.6, 1, 1 })
end)
Noteprefx and postfx draw the same way: only postgui changes the layer.

See also