$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
instanced_rendering.h File Reference

Mesh-based instanced rendering for spheres. More...

#include "gl_common.h"
#include <cglm/cglm.h>
Include dependency graph for instanced_rendering.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SphereInstance
 Per-instance data sent to the shader via an instanced VBO. More...
 
struct  InstancedGroup
 Manages mesh-based instanced spheres on the GPU. More...
 

Functions

void instanced_group_init (InstancedGroup *group, const SphereInstance *data, int count)
 Allocates the instance VBO on the GPU. More...
 
void instanced_group_bind_mesh (InstancedGroup *group, GLuint vbo, GLuint nbo, GLuint ebo)
 Binds a procedural mesh (e.g., icosphere) to the instanced group. More...
 
void instanced_group_draw (InstancedGroup *group, size_t index_count)
 Executes an indexed instanced draw call. More...
 
void instanced_group_cleanup (InstancedGroup *group)
 Releases all GPU resources for the instanced group. More...
 

Detailed Description

Mesh-based instanced rendering for spheres.

This module handles high-performance drawing of multiple mesh-based spheres using glDrawElementsInstanced. It uses a SIMD-aligned structure for instance data.

Function Documentation

◆ instanced_group_bind_mesh()

void instanced_group_bind_mesh ( InstancedGroup group,
GLuint  vbo,
GLuint  nbo,
GLuint  ebo 
)

Binds a procedural mesh (e.g., icosphere) to the instanced group.

Parameters
groupPointer to the group.
vboMesh vertex VBO.
nboMesh normal VBO.
eboMesh index EBO.
Here is the call graph for this function:

◆ instanced_group_cleanup()

void instanced_group_cleanup ( InstancedGroup group)

Releases all GPU resources for the instanced group.

Parameters
groupPointer to the group.

◆ instanced_group_draw()

void instanced_group_draw ( InstancedGroup group,
size_t  index_count 
)

Executes an indexed instanced draw call.

Parameters
groupPointer to the group.
index_countNumber of indices in the base mesh.

◆ instanced_group_init()

void instanced_group_init ( InstancedGroup group,
const SphereInstance data,
int  count 
)

Allocates the instance VBO on the GPU.

Parameters
groupPointer to the group.
dataInitial data (optional).
countNumber of instances.