Open nstoddard opened 5 years ago
Looks like it actually does exist, but it's named tex_image_2d_with_u32_and_u32_and_html_image_element
.
It's unfortunate that the same function has a different name in different versions of WebGL. Would it be possible to use the same name for both?
Thanks for the report! Currently though this crate is entirely procedurally generated from the associated WebIDL. We do approximations for overloads like this given the IDL that we have, often producing weird names like this that can be somewhat inconsistent.
Here I think it's because texImage2d
perhaps has different overloads in the 1/2 versions?
Yep, WebGL 2 adds several more overloads for texImage2d
. But all the overloads from version 1 are still available, and ideally those would have the same name in both versions. Looks like the only difference between the two versions is that the parameter name is different between WebGL 1 and 2, which could be the cause.
We could try to update the WebIDL directly, but that unfortunately may be a breaking change :(
We sort of just do our best in terms of naming and it doesn't always turn out as well as one might expect! Otherwise though it's roughly intended that web-sys is generally how APIs are built rather than the end-point of usage
I'm trying to use
tex_image_2d_with_u32_and_u32_and_image
in WebGL 2, but it seems to only be available in WebGL 1: https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.WebGlRenderingContext.html?search=tex_image_2d_with_u32_and_u32_and_image.From the IDL, it looks like WebGL 2 also adds another overload that takes
HtmlImageElement
plus some new parameters. Why isn't this overload available inweb-sys
?