mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-21 15:29:30 -07:00
That's funny, you can blob a fetch response and chuck it into createImageBitmap().
This commit is contained in:
@@ -4,11 +4,9 @@ const getCanvasSize = (canvas) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const loadTexture = async (device, url) => {
|
const loadTexture = async (device, url) => {
|
||||||
const image = new Image();
|
const response = await fetch(url, { credentials: "include" });
|
||||||
image.crossOrigin = "anonymous";
|
const data = await response.blob();
|
||||||
image.src = url;
|
const imageBitmap = await createImageBitmap(data);
|
||||||
await image.decode();
|
|
||||||
const imageBitmap = await createImageBitmap(image);
|
|
||||||
|
|
||||||
const texture = device.createTexture({
|
const texture = device.createTexture({
|
||||||
size: [imageBitmap.width, imageBitmap.height, 1],
|
size: [imageBitmap.width, imageBitmap.height, 1],
|
||||||
|
|||||||
Reference in New Issue
Block a user