Skip to content

cf_draw3d_push_stroke_depth_write

Category: draw3d
GitHub: cute_draw3d.h


Lets subsequent strokes write to the depth buffer, so they occlude each other.

void cf_draw3d_push_stroke_depth_write(bool depth_write);
Parameters Description
depth_write True to write depth, false (the default) to only test against it.

Remarks

Strokes are anti-aliased ribbons, so by default they test depth but never write it: an AA fringe that owned depth would punch faint halos into whatever draws behind it later. That default also means strokes cannot occlude each other -- a wireframe box shows its back edges drawn over its front ones. Push this to trade the halo risk for self-occlusion, which is what an opaque wireframe usually wants. Only the stroke's solid core writes depth (fringe fragments are discarded), so the trade is small.

Effects never write depth, only cores do, and the multi-segment helpers (cf_draw3d_box_wire, cf_draw3d_polyline, cf_draw3d_axes) draw every segment's effects before any segment's core -- so outlines and depth writes compose, and a corner never shows one edge's outline sitting on its neighbor's core. Hand-rolled multi-stroke shapes made of individual cf_draw3d_line calls don't get that separation, so their shared joints can still show it.

cf_draw3d_pop_stroke_depth_write
cf_draw3d_push_render_state
cf_draw3d_box_wire