# dxDrawPrimitive (Client)

> Draws a 2D primitive (points, lines or triangles) on the screen for one frame.

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

## Syntax

```lua
bool dxDrawPrimitive(string primitiveType, bool postGUI, table vertex1, vertex2, ...)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `primitiveType` | `string` | Primitive type: `pointlist`, `linelist`, `linestrip`, `trianglelist`, `trianglestrip` or `trianglefan`. |
| `postGUI` | `bool` | Draw on top of the interface. |
| `vertex1, vertex2, ...` | `table` | One argument per vertex: `{x, y}` or `{x, y, color}`, in pixels, the colour a `tocolor` value. |

## 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).

## Example

```lua
addEventHandler("onClientRender", root, function()
    dxDrawPrimitive("trianglelist", false,
        { 100, 300, tocolor(255, 0, 0) },
        { 200, 300, tocolor(0, 255, 0) },
        { 150, 200, tocolor(0, 0, 255) })
end)
```

## See also

- [dxDrawMaterialPrimitive (Client)](https://wiki.mymp.gg/en/dxDrawMaterialPrimitive.md): Draws a 2D primitive with an image 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.
- [dxDrawCircle (Client)](https://wiki.mymp.gg/en/dxDrawCircle.md): Draws a filled circle, or a slice of one, on the screen for one frame.
