- Documentation
- Client functions
- dxDrawMaterialPrimitive3D
Function
dxDrawMaterialPrimitive3D
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
dxDrawMaterialLine3DDraws a material (an image, a texture, a browser, a camera or a shader) as a strip in the 3D world: from the start point (top of the image) to the end, with a given width. The strip faces the camera or thefaceX, faceY, faceZpoint. The drawing is part of the world: buildings hide it and it glows (a screen is visible at night). This is how you make a billboard, a cinema screen or a sign above a building.dxDrawPrimitive3DDraws a shape made of triangles in the 3D world from{x, y, z, color}vertices. The whole shape has the colour of the first vertex.