> For the complete documentation index, see [llms.txt](https://docs.quickclient.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.quickclient.cc/en/ui/gpu.md).

# Your own geometry

Meshes you build once and draw every frame.

If the same shape is drawn every frame, there is no need to send its vertices again each time. Build a mesh once with `gpu()` and then just draw it, which is cheaper. Quick keeps the vertices, and the script only holds the mesh name.

```java
private final Mesh marker = gpu().mesh("marker")
        .vertex(-0.5f, 0f, 0f, -1, 0f, 0f)
        .vertex(0.5f, 0f, 0f, -1, 1f, 0f)
        .vertex(0f, 1f, 0f, -1, 0.5f, 1f)
        .build();

@Override
public void onRender3D(Render3D render) {
    Entity target = entities().target();
    if (target != null) {
        render.billboard(marker, target.x(), target.y() + target.height() + 0.3, target.z(), 0.5f, 0xFFFF3B30, true);
    }
}
```

How it works:

* The `marker` mesh is a single white triangle with UV, built once right in the field.
* Every frame it is drawn above the target's head as a billboard, so it always faces the camera.
* The color comes from `tint`: the white vertices turn red.

## Gpu

| Method             | Type          | Description                                  |
| ------------------ | ------------- | -------------------------------------------- |
| `gpu().mesh(name)` | `MeshBuilder` | start building a mesh; finish with `build()` |
| `gpu().names()`    | `String[]`    | names of loaded meshes                       |
| `gpu().drop(name)` | `boolean`     | delete a mesh                                |

## MeshBuilder

Vertices come in threes: every three in a row form a triangle.

| Method                         | Description                                                   |
| ------------------------------ | ------------------------------------------------------------- |
| `vertex(x, y, z, color)`       | vertex without texture coordinates                            |
| `vertex(x, y, z, color, u, v)` | vertex with `UV0`                                             |
| `triangle(points, color)`      | three vertices of one color at once; `points` is nine numbers |
| `build()`                      | hand the mesh to Quick and get a `Mesh`                       |

`Mesh` has `name()`, `vertices()` and `triangles()`.

If a mesh is built from short vertices, Quick writes the draw scale multiplied by 8 into `UV1.x`, and the time in seconds into `LineWidth`. That is enough to animate the mesh in a shader without rebuilding it.

## Where to draw

| Where | Call                                                                                       |
| ----- | ------------------------------------------------------------------------------------------ |
| HUD   | `render.drawMesh(mesh, shader, x, y, scale, tint)` and variants with a texture and sampler |
| world | `mesh(...)` and `billboard(...)` from [3D render](/en/ui/render-3d.md)                     |

How to write your own shader for a mesh is described on the [Shaders](/en/ui/shaders.md) page. If no shader is given, a mesh in the world is drawn with the default Quick shader.

A mesh built in the constructor survives enabling and disabling the script. It is only removed when scripts are reloaded.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.quickclient.cc/en/ui/gpu.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
