- Vertex Specification
- Vertex Processing
- Vertex Post-Processing
- Primitive Assembly
- Fragment Shader
- Per-Sample Processing
To activate the scissor test, first enable the GL_SCISSOR_TEST enumerator. Once enabled, pixels outside of the scissor box will be discarded. To define the scissor box, use this function:
The x and y is the window-space lower-left position of the scissor box, and width and height define the size of the rectangle.
|Core in version||4.6|
|Core since version||4.1|
|Core ARB extension||ARB_viewport_array|
To set the scissor box for a specific viewport, use one of these functions:
void glScissorIndexed(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);void glScissorIndexedv(GLuint index, const GLint *v);
index must be less than GL_MAX_VIEWPORTS. The array version takes 4 integers, in the same order as the parameters for glScissorIndexed.
The scissor box for several viewports can be set with this function:
This sets each viewport's scissor box starting from first up to (but not including) first + count. v is an array, where every 4 elements of the array are the scissor box for a single viewport. Therefore, v is expected to contain 4 * count elements.
Rendering operations that do not specify a viewport index (such as Framebuffer Clearing commands) that still respect the scissor box use scissor box index zero.
The scissor test affects all Rendering Commands that write values to the current draw Framebuffer. Compute shader dispatches are rendering commands, but they do not write to the framebuffer. Even if they write to an image that happens to be within a framebuffer, they are not considered to be writing to the framebuffer.