natiny_material_bind

C
void natiny_material_bind(NatinyMaterial material);

Uses this material for subsequent draws until it is unbound or replaced. A value of 0 selects the built-in material.

Binding flushes the current batch, so queued geometry keeps its previous material.

Parameters

Name Type Description
material NatinyMaterial Material handle from natiny_material_create, or 0 for none

Example

C
natiny_material_bind(material);
draw_group();
natiny_material_unbind();

Notes

  • Binding overrides the material for every draw until unbind, including model and per-part materials. A material texture slot overrides a model texture only when the slot was explicitly assigned; an open slot inherits the texture supplied by the draw.
  • It does not change what natiny_render_tag selects; tags are read from each model's own material.
  • Each bind and unbind flushes the current batch. Bind once around a group of draws rather than once per draw.
  • Binding another material replaces the current override. natiny_material_unbind is equivalent to binding 0; it does not restore the previous material.
  • A surface carries the current material into its pass and restores the suspended material when unbound; see The bind stack.