Created
April 29, 2017 23:08
-
-
Save nkint/fd0fbf30fc1844ebb12ad181c010ed7c to your computer and use it in GitHub Desktop.
load image from url into a regl.texture object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const emptyTextureDimension = { | |
width: 512, | |
height: 512, | |
channels: 3, | |
} | |
function loadImageIntoTexture(url, texture) { | |
const image = new Image() | |
image.crossOrigin = 'anonymous' | |
image.src = url | |
image.onload = function () { | |
texture({ data: image }) | |
} | |
} | |
const satelliteTexture = regl.texture(emptyTextureDimension) | |
const satelliteUrl = getTextureUrl(tile) // here is something | |
loadImageIntoTexture(satelliteUrl, satellite) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment