| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> | 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> |
| 4 <script type="text/javascript" src="depth_stream_test_utilities.js"></script> | 4 <script type="text/javascript" src="depth_stream_test_utilities.js"></script> |
| 5 <script type="text/javascript"> | 5 <script type="text/javascript"> |
| 6 | 6 |
| 7 function cubemapFaces(gl) { | 7 function cubemapFaces(gl) { |
| 8 return [gl.TEXTURE_CUBE_MAP_POSITIVE_X, | 8 return [gl.TEXTURE_CUBE_MAP_POSITIVE_X, |
| 9 gl.TEXTURE_CUBE_MAP_NEGATIVE_X, | 9 gl.TEXTURE_CUBE_MAP_NEGATIVE_X, |
| 10 gl.TEXTURE_CUBE_MAP_POSITIVE_Y, | 10 gl.TEXTURE_CUBE_MAP_POSITIVE_Y, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 return verifyPixels(imageData.data, canvas.width, canvas.height, flip_y, | 137 return verifyPixels(imageData.data, canvas.width, canvas.height, flip_y, |
| 138 color_step, 255, 2, "ImageBitmap"); | 138 color_step, 255, 2, "ImageBitmap"); |
| 139 } | 139 } |
| 140 | 140 |
| 141 function testVideoToRGBA32FTexture(videoElementName, success, error) { | 141 function testVideoToRGBA32FTexture(videoElementName, success, error) { |
| 142 var video = $(videoElementName); | 142 var video = $(videoElementName); |
| 143 var canvas = document.createElement('canvas'); | 143 var canvas = document.createElement('canvas'); |
| 144 canvas.width = 96; | 144 canvas.width = 96; |
| 145 canvas.height = 96; | 145 canvas.height = 96; |
| 146 var gl = canvas.getContext('webgl'); | 146 var gl = canvas.getContext('webgl'); |
| 147 if(!gl) | 147 if (!gl) |
| 148 return error({name:"WebGL is not available."}); | 148 return error({name:"WebGL is not available."}); |
| 149 if(!gl.getExtension("OES_texture_float")) | 149 if (!gl.getExtension("OES_texture_float")) |
| 150 return error({name:"OES_texture_float extension is not available."}); | 150 return error({name:"OES_texture_float extension is not available."}); |
| 151 return testVideoToTexture(gl, video, gl.RGBA, gl.RGBA, gl.FLOAT, | 151 return testVideoToTexture(gl, video, gl.RGBA, gl.RGBA, gl.FLOAT, |
| 152 readAndVerifyRGBA32F, success, error); | 152 readAndVerifyRGBA32F, success, error); |
| 153 } | 153 } |
| 154 | 154 |
| 155 function testVideoToRGBA8Texture(videoElementName, success, error) { | 155 function testVideoToRGBA8Texture(videoElementName, success, error) { |
| 156 var video = $(videoElementName); | 156 var video = $(videoElementName); |
| 157 var canvas = document.createElement('canvas'); | 157 var canvas = document.createElement('canvas'); |
| 158 canvas.width = 96; | 158 canvas.width = 96; |
| 159 canvas.height = 96; | 159 canvas.height = 96; |
| 160 var gl = canvas.getContext('webgl'); | 160 var gl = canvas.getContext('webgl'); |
| 161 if(!gl) | 161 if (!gl) |
| 162 return error({name:"WebGL is not available."}); | 162 return error({name:"WebGL is not available."}); |
| 163 return testVideoToTexture(gl, video, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, | 163 return testVideoToTexture(gl, video, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, |
| 164 readAndVerifyRGBA8, success, error); | 164 readAndVerifyRGBA8, success, error); |
| 165 } | 165 } |
| 166 | 166 |
| 167 function testVideoToR32FTexture(videoElementName, success, error) { | 167 function testVideoToR32FTexture(videoElementName, success, error) { |
| 168 var video = $(videoElementName); | 168 var video = $(videoElementName); |
| 169 var canvas = document.createElement('canvas'); | 169 var canvas = document.createElement('canvas'); |
| 170 canvas.width = 96; | 170 canvas.width = 96; |
| 171 canvas.height = 96; | 171 canvas.height = 96; |
| 172 var gl = canvas.getContext('webgl2'); | 172 var gl = canvas.getContext('webgl2'); |
| 173 if(!gl) | 173 if (!gl) |
| 174 return error({name:"WebGL2 is not available."}); | 174 return error({name:"WebGL2 is not available."}); |
| 175 var color_buffer_float_ext = gl.getExtension('EXT_color_buffer_float'); | 175 if (!gl.getExtension('EXT_color_buffer_float')) |
| 176 return error({name:"EXT_color_buffer_float extension is not available."}); |
| 176 return testVideoToTexture(gl, video, gl.R32F, gl.RED, gl.FLOAT, | 177 return testVideoToTexture(gl, video, gl.R32F, gl.RED, gl.FLOAT, |
| 177 readAndVerifyR32F, success, error); | 178 readAndVerifyR32F, success, error); |
| 178 } | 179 } |
| 179 | 180 |
| 180 function testVideoToTexture(gl, video, internalformat, format, type, | 181 function testVideoToTexture(gl, video, internalformat, format, type, |
| 181 readAndVerifyFunction, success, error) { | 182 readAndVerifyFunction, success, error) { |
| 182 // Create framebuffer that we will use for reading back the texture. | 183 // Create framebuffer that we will use for reading back the texture. |
| 183 var fb = gl.createFramebuffer(); | 184 var fb = gl.createFramebuffer(); |
| 184 gl.bindFramebuffer(gl.FRAMEBUFFER, fb); | 185 gl.bindFramebuffer(gl.FRAMEBUFFER, fb); |
| 185 var tests = []; | 186 var tests = []; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 <tr> | 336 <tr> |
| 336 <td><video id="local-view-1" width="96" height="96" autoplay | 337 <td><video id="local-view-1" width="96" height="96" autoplay |
| 337 style="display:none"></video></td> | 338 style="display:none"></video></td> |
| 338 <!-- The canvas is used to detect when video starts and stops. --> | 339 <!-- The canvas is used to detect when video starts and stops. --> |
| 339 <td><canvas id="local-view-1-canvas" width="96" height="96" | 340 <td><canvas id="local-view-1-canvas" width="96" height="96" |
| 340 style="display:none"></canvas></td> | 341 style="display:none"></canvas></td> |
| 341 </tr> | 342 </tr> |
| 342 </table> | 343 </table> |
| 343 </body> | 344 </body> |
| 344 </html> | 345 </html> |
| OLD | NEW |