natiny_surface_get_texture
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
NatinyTexture texture = natiny_surface_get_texture(surface);
Notes
- The texture belongs to the surface: destroying it with
natiny_texture_destroywould leave the surface with nothing to draw into.natiny_surface_destroyfrees both attachments. - Reading a surface in the same pass that writes it is undefined; unbind it first.