natiny_surface_get_texture

C
NatinyTexture natiny_surface_get_texture(NatinySurface surf);

Returns the surface's color attachment as a texture handle.

The handle stays valid until the surface is destroyed - or until a resize, which replaces the attachment, after which this has to be asked again.

Parameters

Name Type Description
surf NatinySurface Surface handle

Returns

Type Description
NatinyTexture Texture handle, or 0 if the surface is not valid

Example

C
NatinyTexture texture = natiny_surface_get_texture(surface);

Notes

  • The texture belongs to the surface: destroying it with natiny_texture_destroy would leave the surface with nothing to draw into. natiny_surface_destroy frees both attachments.
  • Reading a surface in the same pass that writes it is undefined; unbind it first.