2
0
Эх сурвалжийг харах

WebGLState: Use getParameter() to detect current scissor/viewport. (#21831)

* WebGLState: Use getParameter() to detect current scissor/viewport.

* WebGLState: Simplify code.
Michael Herzog 4 жил өмнө
parent
commit
be73fc9bdc

+ 5 - 2
src/renderers/webgl/WebGLState.js

@@ -360,8 +360,11 @@ function WebGLState( gl, extensions, capabilities ) {
 	let currentTextureSlot = null;
 	let currentBoundTextures = {};
 
-	const currentScissor = new Vector4( 0, 0, gl.canvas.width, gl.canvas.height );
-	const currentViewport = new Vector4( 0, 0, gl.canvas.width, gl.canvas.height );
+	const scissorParam = gl.getParameter( gl.SCISSOR_BOX );
+	const viewportParam = gl.getParameter( gl.VIEWPORT );
+
+	const currentScissor = new Vector4().fromArray( scissorParam );
+	const currentViewport = new Vector4().fromArray( viewportParam );
 
 	function createTexture( type, target, count ) {