File: WebGLShader.html

package info (click to toggle)
three.js 111%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 15,212 kB
  • sloc: javascript: 133,174; makefile: 24; sh: 1
file content (51 lines) | stat: -rw-r--r-- 1,379 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<base href="../../../../" />
		<script src="list.js"></script>
		<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>Example</h2>

		<code>
		var gl = renderer.getContext();

		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 );
		</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>