Skip to content

Commit

Permalink
Merge pull request #422 from ecomfe/fix-ssr
Browse files Browse the repository at this point in the history
fix: make code work on server side
  • Loading branch information
pissang authored Aug 5, 2021
2 parents e516a19 + 02adf78 commit b5d4e7b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/util/graphicGL.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,15 @@ graphicGL.BoundingBox = BoundingBox;
graphicGL.Frustum = Frustum;

// Texture utilities
var blankImage = null;

var blankImage = textureUtil.createBlank('rgba(255,255,255,0)').image;
function getBlankImage() {
if (blankImage !== null) {
return blankImage;
}
blankImage = textureUtil.createBlank('rgba(255,255,255,0)').image;
return blankImage;
}


function nearestPowerOfTwo(val) {
Expand Down Expand Up @@ -340,7 +347,7 @@ graphicGL.loadTexture = function (imgValue, api, textureOpts, cb) {
originalImage.crossOrigin = 'Anonymous';
originalImage.src = imgValue;
// Use blank image as place holder.
texture.image = blankImage;
texture.image = getBlankImage();

textureCache.put(prefix + imgValue, textureObj);
}
Expand Down Expand Up @@ -675,4 +682,4 @@ graphicGL.updateVertexAnimation = function (
}
};

export default graphicGL;
export default graphicGL;

0 comments on commit b5d4e7b

Please sign in to comment.