Start maybe working on a native app
This commit is contained in:
@@ -3,10 +3,11 @@
|
||||
|
||||
import { create_texture, device, push_quad, push_quad_vertices, use_texture } from "./core.ts";
|
||||
import { Texture } from "./types.ts";
|
||||
import type { Pixels } from "../png.ts";
|
||||
|
||||
export function load_texture(image: HTMLImageElement | ImageBitmap): Texture {
|
||||
export function load_texture(image: Pixels): Texture {
|
||||
const texture = create_texture(image.width, image.height);
|
||||
device.queue.copyExternalImageToTexture({ source: image }, { texture }, [image.width, image.height]);
|
||||
device.queue.writeTexture({ texture }, image.data, { bytesPerRow: image.width * 4 }, [image.width, image.height]);
|
||||
|
||||
return {
|
||||
tex: texture,
|
||||
|
||||
Reference in New Issue
Block a user