Based on the second half of https://learnopengl.com/Getting-started/Hello-Triangle from Element Buffer Objects onward.
Press space
to toggle between filled and wireframe pipelines.
Note that we need multiple definitions of the render pipeline with different polygon_mode
's:
fill_pipeline
usesPolygonMode::Fill
wireframe_pipeline
usesPolygonMode::Line
Only POLYGON_MODE_FILL
is enabled by default so the POLYGONE_MODE_LINE
feature must be enabled explicitly.