[name]

A lower level function to compile either a vertex or fragment shader.

Example

var gl = renderer.context; var glVertexShader = new THREE.WebGLShader( gl, gl.VERTEX_SHADER, vertexSourceCode ); var glFragmentShader = new THREE.WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentSourceCode ); var program = gl.createProgram(); gl.attachShader( program, glVertexShader ); gl.attachShader( program, glFragmentShader ); gl.linkProgram( program );

Function

[page:WebGLShader objects]([page:WebGLContext gl], [page:WebGLEnum type], [page:String source])

gl -- The current WebGL context type -- The WebGL type, either gl.VERTEX_SHADER or gl.FRAGMENT_SHADER source -- The source code for the shader
This will compile an individual shader, but won't link it to be a complete [page:WebGLProgram]. Note: this is a function so the new operator should not be used.

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]