Debian Codegraph @

api_webgl/extensions/rejected/WEBGL_texture_from_depth_video/extension.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8"?>
2 <rejected href="rejected/WEBGL_texture_from_depth_video/">
3 <name>WEBGL_texture_from_depth_video</name>
4
5 <contact><a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL
6 working group</a> (public_webgl 'at' khronos.org) </contact>
7
8 <contributors>
9 <contributor>Ningxin Hu, Intel</contributor>
10 <contributor>Anssi Kostiainen, Intel</contributor>
11 <contributor>Rob Manson, buildAR</contributor>
12 <contributor>Members of the WebGL working group</contributor>
13 </contributors>
14
15 <number>NN</number>
16
17 <depends>
18 <api version="1.0"/>
19 </depends>
20
21 <overview id="overview">
22
23 <p>This extension provides support for the <a
24 href="http://w3c.github.io/mediacapture-depth/">Media
25 Capture Depth Stream Extensions</a>. Specifically, it supports
26 uploading to a WebGL texture a <code>video</code> element whose
27 source is a <code>MediaStream</code> object containing a <a
28 href="http://w3c.github.io/mediacapture-depth/#dfn-depth-track">
29 depth track</a>.</p>
30
31 <features>
32 <feature>
33 A <code>video</code> element whose source is a <code>MediaStream</code>
34 object containing a <a
35 href="http://w3c.github.io/mediacapture-depth/#dfn-depth-track">
36 depth track</a> may be uploaded to a WebGL
37 texture of format <code>RGB</code> and type
38 <code>UNSIGNED_SHORT_5_6_5</code>.
39 </feature>
40 </features>
41 </overview>
42
43 <idl xml:space="preserve">
44 [NoInterfaceObject]
45 interface WEBGL_texture_from_depth_video {
46 };
47 </idl>
48
49 <samplecode>
50 <div class="example">
51
52 This code sets up a video element from a depth stream, uploads
53 it to a WebGL texture, and samples that texture in the fragment
54 shader, reconstructing the 16-bit depth values from the red,
55 green and blue channels.
56
57 <pre xml:space="preserve">var ext = gl.getExtension("WEBGL_texture_from_depth_video");
58 if (ext) {
59 navigator.getUserMedia({ video: true }, successVideo, failureVideo);
60 }
61
62 var depthVideo;
63
64 function successVideo(s) {
65 // wire the stream into a &lt;video&gt; element for playback
66 depthVideo = document.querySelector('#video');
67 depthVideo.src = URL.createObjectURL(s);
68 depthVideo.play();
69 }
70
71 // ... later, in the rendering loop ...
72
73 if (ext) {
74 gl.texImage2D(
75 gl.TEXTURE_2D,
76 0,
77 gl.RGB,
78 gl.RGB,
79 gl.UNSIGNED_SHORT_5_6_5,
80 depthVideo
81 );
82 }
83
84 &lt;script id="fragment-shader" type="x-shader/x-fragment"&gt;
85 varying vec2 v_texCoord;
86 // u_tex points to the texture unit containing the depth texture.
87 uniform sampler2D u_tex;
88 void main() {
89 vec4 floatColor = texture2D(u_tex, v_texCoord);
90 vec3 rgb = floatColor.rgb;
91 ...
92 float depth = 63488. * rgb.r + 2016. * rgb.g + 31. * rgb.b;
93 ...
94 }
95 &lt;/script&gt;</pre></div>
96 </samplecode>
97
98 <issues>
99 </issues>
100 <history>
101 <revision date="2014/11/03">
102 <change>Initial revision.</change>
103 </revision>
104 <revision date="2015/01/24">
105 <change>Moved to rejected on the grounds that it can be done without an extension.</change>
106 </revision>
107 </history>
108 </rejected>