Setting scissor states dynamically
The viewport defines a part of an attachment (image) to which the clip's space will be mapped. The scissor test allows us to additionally confine a drawing to the specified rectangle within the specified viewport dimensions. The scissor test is always enabled; we can only set up various values for its parameters. This can be done statically during the pipeline creation, or dynamically. The latter is done with a function call recorded in a command buffer.
How to do it...
- Store the handle of a command buffer that is in a recording state in a variable of type
VkCommandBuffer
namedcommand_buffer
. - Specify the number of the first scissor rectangle in a variable of type
uint32_t
namedfirst_scissor
. Remember that the number of scissor rectangles corresponds to the number of viewports. - Create a variable of type
std::vector<VkRect2D>
namedscissors
. For each scissor rectangle we want to specify, add an element to thescissors
variable. Use the following values...