# dxDrawMaterialPrimitive3D (Client)

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

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Screen drawing
- **URL**: https://wiki.mymp.gg/en/dxDrawMaterialPrimitive3D

## Syntax

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

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `primitiveType` | `string` | Primitive type: `pointlist`, `linelist`, `linestrip`, `trianglelist`, `trianglestrip` or `trianglefan`. |
| `material` | `texture\|dui\|string` | The image (a texture, render target, screen source or dui) or the path of an image file in the resource. |
| `stage` | `string\|bool` | When to draw: `prefx`, `postfx` or `postgui`, or a boolean (`true` means `postgui`). *(default: `postfx`)* |
| `vertex1, vertex2, ...` | `table` | One 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

```lua
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)
```

### Note

`prefx` and `postfx` draw the same way: only `postgui` changes the layer.

## See also

- [dxDrawMaterialPrimitive (Client)](https://wiki.mymp.gg/en/dxDrawMaterialPrimitive.md): Draws a 2D primitive with an image on the screen for one frame.
- [dxDrawMaterialLine3D (Client)](https://wiki.mymp.gg/en/dxDrawMaterialLine3D.md): Draws an image stretched along a line in the 3D world for one frame.
- [dxDrawPrimitive (Client)](https://wiki.mymp.gg/en/dxDrawPrimitive.md): Draws a 2D primitive (points, lines or triangles) on the screen for one frame.
