natiny_surface_bind
void natiny_surface_bind(NatinySurface surf, uint32_t slot);
Makes the surface a render target. Bind it between natiny_window_bind and
natiny_window_unbind so drawing has an active frame command buffer. Multiple
surfaces can be bound to distinct slots for one pass.
Parameters
| Name | Type | Description |
|---|---|---|
surf |
NatinySurface |
Surface handle from natiny_surface_create |
slot |
uint32_t |
Target slot, 0 to NATINY_MAX_TARGETS - 1 |
Example
natiny_window_bind(win);
natiny_surface_bind(rt, 0);
draw_scene();
natiny_surface_unbind();
natiny_window_unbind();
Notes
- Slot
0opens a target set and determines its size, 2D projection, and depth attachment. Other slots add colour targets to that set. All surfaces in a set must have identical dimensions. - Surface binds may nest up to 64 stored levels. Deeper binds still take effect, but their previous state cannot be restored.