主管重读时遇到的问题
遇到此错误,请帮帮我。
错误
var VertexShaderCode = "precision mediump float;"+
"attribute vec3 vertexPos;\n" +
"uniform mat4 modelViewMatrix;\n" +
"uniform mat4 projectionMatrix;\n" +
"attribute vec2 aTextureCoord;"+
"varying vec2 vTextureCoord;"+
" void main(void) {\n" +
" gl_Position = projectionMatrix * modelViewMatrix * vec4(vertexPos, 1.0); \n" +
" vTextureCoord = aTextureCoord;"+
"}\n";
var vertexShader = gl.createShader(gl.VERTEX_SHADER)
gl.shaderSource(vertexShader, VertexShaderCode)
gl.compileShader(vertexShader)
var FragmentShaderCode = "precision lowp float;"+
"varying vec2 vTextureCoord;"+
"uniform sampler2D uSampler;"+
"uniform vec4 color;"+
"void main() { "+
" gl_FragColor = texture2D(uSampler, vTextureCoord)*vec4(color);"+
"}"
var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER)
gl.shaderSource(fragmentShader, FragmentShaderCode)
gl.compileShader(fragmentShader)
var shaderProgram= gl.createProgram()
gl.attachShader(shaderProgram, vertexShader )
gl.attachShader(shaderProgram, fragmentShader )
gl.linkProgram(shaderProgram)
return shaderProgram