Наши волонтёры ещё не перевели данную статью на Русский. Присоединяйтесь к нам и помогите сделать эту работу!
Вы можете также прочитать эту статью на English (US).

The WebGLRenderingContext.scissor() method of the WebGL API sets a scissor box, which limits the drawing to a specified rectangle.


void gl.scissor(x, y, width, height);


A GLint specifying the horizontal coordinate for the lower left corner of the box. Default value: 0.
A GLint specifying the vertical coordinate for the lower left corner of the box. Default value: 0.
A non-negative Glsizei specifying the width of the scissor box. Default value: width of the canvas.
A non-negative Glsizei specifying the height of the scissor box. Default value: height of the canvas.

Return value



If either width or height is a negative value, a gl.INVALID_VALUE error is thrown.


When the scissor test is enabled, only pixels within the scissor box can be modified by drawing commands.

// turn on scissor test

// set the scissor rectangle
gl.scissor(x, y, width, height);

// execute drawing commands in the scissor box (e.g. clear)

// turn off scissor test again

To get the current scissor box dimensions, query the SCISSOR_BOX constant which returns an Int32Array.

gl.scissor(0, 0, 200, 200);
// Int32Array[0, 0, 200, 200]


Specification Status Comment
WebGL 1.0
The definition of 'scissor' in that specification.
Recommendation Initial definition.
OpenGL ES 2.0
The definition of 'glScissor' in that specification.
Standard Man page of the OpenGL API.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
scissorChrome Full support 9Edge Full support 12Firefox Full support 4IE Full support 11Opera Full support 12Safari Full support 5.1WebView Android Full support YesChrome Android Full support 25Edge Mobile Full support YesFirefox Android Full support YesOpera Android Full support 12Safari iOS Full support 8.1Samsung Internet Android Full support Yes


Full support  
Full support

See also

Метки документа и участники

Внесли вклад в эту страницу: mdnwebdocs-bot, fscholz, teoli
Обновлялась последний раз: mdnwebdocs-bot,