> For the complete documentation index, see [llms.txt](https://vape-docs.gitbook.io/vape3d-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vape-docs.gitbook.io/vape3d-docs/renderer-interface.md).

# Renderer Setup

Setting up a renderer via the renderer API

{% hint style="info" %}
Static polymorphism is used for the renderer implementation, meaning that you can specify its type on compile time but cannot change it during run-time of your application. \
That said, it is a simple and easily extendable interface for creating different types of renderers if needed. The most stable one, that is supported now is the **`ForwardRenderer`**, which is also the simplest one when it comes to 3D renderers.
{% endhint %}

#### Set up flow of the Renderer

Create a renderer object

```cpp
auto renderer = std::make_shared<ForwardRenderer>();
```

Create renderer queue (initially allocated 1000 rend. commands)

```cpp
renderer.Begin()
```

Submit all renderable objects to the queue

{% hint style="info" %}
The **SubmitMesh** function accepts renderables of base type Mesh.
{% endhint %}

```cpp
std::for_each(meshes.begin(), meshes.end(), [&](const auto& mesh)
{
    ...
    renderer.SubmitMesh(mesh)
    ...
}
```

Display all content from the renderer

```cpp
renderer.Present();
```

Optimize renderer queue if needed (batching, sorting, etc.)

```cpp
renderer.End()
```
