1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <base href="../../../../" />
- <script src="page.js"></script>
- <link type="text/css" rel="stylesheet" href="page.css" />
- </head>
- <body>
- <h1>[name]</h1>
- <p class="desc">A lower level function to compile either a vertex or fragment shader.</p>
- <h2>Code Example</h2>
- <code>
- const gl = renderer.getContext();
- const glVertexShader = new THREE.WebGLShader( gl, gl.VERTEX_SHADER, vertexSourceCode );
- const glFragmentShader = new THREE.WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentSourceCode );
- const program = gl.createProgram();
- gl.attachShader( program, glVertexShader );
- gl.attachShader( program, glFragmentShader );
- gl.linkProgram( program );
- </code>
- <h2>Function</h2>
- <h3>[page:WebGLShader objects]([page:WebGLContext gl], [page:WebGLEnum type], [page:String source])</h3>
- <p>
- gl -- The current WebGL context
- type -- The WebGL type, either gl.VERTEX_SHADER or gl.FRAGMENT_SHADER
- source -- The source code for the shader
- </p>
- <p>
- 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.
- </p>
- <h2>Source</h2>
- <p>
- [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
- </p>
- </body>
- </html>
|