Explorar o código

Merge pull request #9861 from Ludobaka/fix_line_width_ie11

Fixed INVALID_OPERATION error with WebGL when using linewidth on IE11
Mr.doob %!s(int64=8) %!d(string=hai) anos
pai
achega
7931f84910
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      src/renderers/webgl/WebGLState.js

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

@@ -342,6 +342,10 @@ function WebGLState( gl, extensions, paramThreeToGL ) {
 
 	var maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
 
+	var glVersion = gl.getParameter(gl.VERSION).split(' ')[1];
+	var glMajorVersion = glVersion.split('.').slice(0, 2).join('.');
+	var lineWidthAvailable = parseFloat(glMajorVersion) >= 1.0;
+
 	var currentTextureSlot = null;
 	var currentBoundTextures = {};
 
@@ -732,7 +736,7 @@ function WebGLState( gl, extensions, paramThreeToGL ) {
 
 		if ( width !== currentLineWidth ) {
 
-			gl.lineWidth( width );
+			if ( lineWidthAvailable ) gl.lineWidth( width );
 
 			currentLineWidth = width;