Skip to content

Load textures from HtmlImageElement, HtmlCanvasElement, or ImageBitmap #31

Description

@austinjones

Hello Ryan,
This is such a neat library - it's really useful to be able to render to both WebGL and native. The shader semantics are nicely done!

There isn't any way to load textures from web_sys objects, though. I tried using BitmapImage::map_data_into_with_u8_array to get a [u8], but the mapDataInto binding doesn't exist in Firefox. Glow recently added support for loading directly from HtmlImageElement/Canvas/ImageBitmap.

I was able to get the Glow methods working on this branch - though the Cargo changes were awkward. Glow doesn't re-export the web_sys objects, and I had to rename the features (because Cargo won't allow both a feature and a dependency to have the same name).

Feel free to take the code if you implement this in the future - or if you can think of a better way to get the web_sys objects exported, I can clean it up for a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions