# dxDrawMaterialPrimitive (Client)

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

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

## Syntax

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

## 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. |
| `postGUI` | `bool` | Draw on top of the interface. |
| `vertex1, vertex2, ...` | `table` | One 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

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

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