|
@@ -86,6 +86,7 @@ function Renderer(container, image, imageType, video) { |
|
|
var loaded = 0; |
|
|
var loaded = 0; |
|
|
var world = this.world; |
|
|
var world = this.world; |
|
|
var container = this.container; |
|
|
var container = this.container; |
|
|
|
|
|
var renderer = this; |
|
|
var onLoad = function() { |
|
|
var onLoad = function() { |
|
|
// Draw image on canvas |
|
|
// Draw image on canvas |
|
|
var faceCanvas = document.createElement('canvas'); |
|
|
var faceCanvas = document.createElement('canvas'); |
|
@@ -147,6 +148,7 @@ function Renderer(container, image, imageType, video) { |
|
|
if (loaded == 6) { |
|
|
if (loaded == 6) { |
|
|
fallbackImgSize = this.width; |
|
|
fallbackImgSize = this.width; |
|
|
container.appendChild(world); |
|
|
container.appendChild(world); |
|
|
|
|
|
renderer.image = null; |
|
|
callback(); |
|
|
callback(); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
@@ -286,9 +288,14 @@ function Renderer(container, image, imageType, video) { |
|
|
gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, this.image[5]); |
|
|
gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, this.image[5]); |
|
|
gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, this.image[0]); |
|
|
gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, this.image[0]); |
|
|
gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, this.image[2]); |
|
|
gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, this.image[2]); |
|
|
|
|
|
this.image = undefined; |
|
|
} else { |
|
|
} else { |
|
|
// Upload image to the texture |
|
|
// Upload image to the texture |
|
|
gl.texImage2D(glBindType, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, this.image); |
|
|
gl.texImage2D(glBindType, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, this.image); |
|
|
|
|
|
if (this.video !== true) { |
|
|
|
|
|
// Allow memory to be freed |
|
|
|
|
|
this.image = undefined; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Set parameters for rendering any size |
|
|
// Set parameters for rendering any size |
|
|