Skip to content

Commit b222118

Browse files
committed
WebGLState: Use getParameter() to detect current scissor/viewport.
1 parent f7b2c62 commit b222118

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/renderers/webgl/WebGLState.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,11 @@ function WebGLState( gl, extensions, capabilities ) {
360360
let currentTextureSlot = null;
361361
let currentBoundTextures = {};
362362

363-
const currentScissor = new Vector4( 0, 0, gl.canvas.width, gl.canvas.height );
364-
const currentViewport = new Vector4( 0, 0, gl.canvas.width, gl.canvas.height );
363+
const scissorParam = gl.getParameter( gl.VIEWPORT );
364+
const viewportParam = gl.getParameter( gl.VIEWPORT );
365+
366+
const currentScissor = new Vector4( scissorParam[ 0 ], scissorParam[ 1 ], scissorParam[ 2 ], scissorParam[ 3 ] );
367+
const currentViewport = new Vector4( viewportParam[ 0 ], viewportParam[ 1 ], viewportParam[ 2 ], viewportParam[ 3 ] );
365368

366369
function createTexture( type, target, count ) {
367370

0 commit comments

Comments
 (0)