Skip to content

cf_draw3d_set_texture

Category: draw3d
GitHub: cute_draw3d.h


Binds a texture for subsequent mesh submissions, by name.

void cf_draw3d_set_texture(const char* name, CF_Texture texture);
Parameters Description
name The name of the sampler uniform in the shader.
texture The texture to bind.

Remarks

Bind a canvas's targets to sample a previous pass: cf_canvas_get_target for color, cf_canvas_get_depth_stencil_target for depth. When mapping clip-space positions to canvas uvs (shadow maps), v runs top-down: uv = vec2(ndc.x, -ndc.y) * 0.5 + 0.5 on every backend. See the draw3d sample for a complete shadow-mapped scene.

cf_canvas_get_depth_stencil_target
cf_draw3d_set_uniform
CF_Texture
cf_canvas_get_target