natiny_window_bind

C
void natiny_window_bind(NatinyWindow id);

Binds a window as the render target until it is unbound or replaced.

Parameters

Name Type Description
id NatinyWindow Window handle from natiny_window_create

Example

C
natiny_window_bind(win);
draw_frame();
natiny_window_unbind();

Notes

  • Every bind resets the clear color, draw color, current texture, camera, material and surface targets to defaults. Call natiny_render_clear when the existing pixels should be replaced.
  • Binding over a different window ends its frame. The matching natiny_window_unbind starts a new frame for the previous window.
  • Binding or unbinding a window drops any open surface target sets and reports their count to standard error. Bind the window before its surfaces; see The bind stack.
  • Rebinding the same window inside one natiny_backend_loop callback preserves its earlier draws. The accumulated image is presented after the callback.
  • In NATINY_SCALE_MODE_STRETCH, the off-screen canvas is copied to the window once when the engine frame is presented.