Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/prog5/prog5.html b/prog5/prog5.html
- index 1a75e38..38ca76a 100644
- --- a/prog5/prog5.html
- +++ b/prog5/prog5.html
- @@ -91,7 +91,7 @@ Project 5 -->
- Z-AXIS<input id="z-light" type="range" min="-5.0" max="5.0" value="0" step="0.1" oninput="refresh()">
- </font>
- </center>
- - <video id="video" src="Firefox.ogv" autoplay muted>
- + <video id="video" src="Firefox.ogv" autoplay muted style="display: none;">
- Your browser doesn't appear to support the <code><video></code> element.
- </video>
- diff --git a/prog5/prog5.js b/prog5/prog5.js
- index 3bbd660..77b6710 100644
- --- a/prog5/prog5.js
- +++ b/prog5/prog5.js
- @@ -21,6 +21,7 @@ var lastClientY;
- var videoElement;
- var modelTexture;
- +var copyVideo;
- //refresh function used to request animation frame after moving slider in HTML
- function refresh(){
- @@ -171,7 +172,6 @@ function loadTexture(image, texture){
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
- - requestAnimationFrame(draw);
- }
- @@ -194,8 +194,14 @@ function init(){
- videoElement = document.getElementById("video");
- modelTexture = gl.createTexture();
- + // put 1 pixel in it so we can render before the video starts
- + gl.bindTexture(gl.TEXTURE_2D, modelTexture);
- + gl.texImage2D(
- + gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE,
- + new Uint8Array([255, 255, 255, 255]));
- videoElement.addEventListener("canplaythrough", startVideo, true);
- + videoElement.addEventListener("playing", () => { copyVideo = true; }, true);
- videoElement.addEventListener("ended", videoDone, true);
- /* videoElement.onload = function() {
- @@ -217,7 +223,9 @@ function init(){
- function draw(){
- + if (copyVideo) {
- updateTexture();
- + }
- //compose matrices for transformations
- var viewMatrix = new Matrix4();
- var projectionMatrix = new Matrix4();
Advertisement
Add Comment
Please, Sign In to add comment