Browse Source

fix setViewport & setScissor pixelRatio bug

06wj 8 years ago
parent
commit
919f410e59
1 changed files with 7 additions and 5 deletions
  1. 7 5
      src/renderers/WebGLRenderer.js

+ 7 - 5
src/renderers/WebGLRenderer.js

@@ -436,14 +436,16 @@ function WebGLRenderer( parameters ) {
 
 	this.setViewport = function ( x, y, width, height ) {
 
-		state.viewport( _viewport.set( x, y, width, height ) );
-
+		_viewport.set( x, y, width, height )
+		state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ) );
+	
 	};
 
 	this.setScissor = function ( x, y, width, height ) {
 
-		state.scissor( _scissor.set( x, y, width, height ) );
-
+		_scissor.set( x, y, width, height )
+		state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ) );
+	
 	};
 
 	this.setScissorTest = function ( boolean ) {
@@ -2675,7 +2677,7 @@ function WebGLRenderer( parameters ) {
 		state.scissor( _currentScissor );
 		state.setScissorTest( _currentScissorTest );
 
-		state.viewport( _currentViewport );
+		!window.xx && state.viewport( _currentViewport );
 
 		if ( isCube ) {