Setting line width states dynamically
One of the parameters defined during the graphics pipeline creation is the width of drawn lines. We can define it statically. But if we intend to draw multiple lines with different widths, we should specify line width as one of the dynamic states. This way, we can use the same pipeline object and specify the width of the drawn lines with a function call.
How to do it...
- Take the handle of a command buffer that is being recorded and use it to initialize a variable of type
VkCommandBuffer
namedcommand_buffer
. - Create a variable of type
float
namedline_width
through which the width of drawn lines will be provided. - Call
vkCmdSetLineWidth( command_buffer, line_width )
providing thecommand_buffer
andline_width
variables.
How it works...
Setting the width of lines dynamically for a given graphics pipeline is performed with the vkCmdSetLineWidth()
function call. We just need to remember that to use various widths, we must enable the wideLines
feature during the...