wasm-bindgen icon indicating copy to clipboard operation
wasm-bindgen copied to clipboard

Unable to invoke `AngleInstanceArrays::draw_arrays_instanced_angle`

Open kulicuu opened this issue 2 years ago • 1 comments

Describe the Bug

Ambiguous documentation and failing execution of web_sys::AngleInstancedArrays.

Steps to Reproduce

I have a Stackoverflow question here: https://stackoverflow.com/questions/72834638/how-to-invoke-rust-web-sys-angleinstancedarrays

I've enabled the AngleInstancedArrays in the web-sys.features in Cargo.toml.

I am able to access and invoke the function 'draw_arrays_instanced_angle', but it requires a reference to &self as first argument, but there is no way (at least none documented or obvious) to instantiate an AngleInstanceArrays struct.

https://github.com/kulicuu/yew_webgl2_game/blob/master/src/components/game.rs#L151

kulicuu avatar Jul 02 '22 15:07 kulicuu

web_sys::AngleInstancedArrays is a JS structure in the browser, a handle is obtained with WebGl2RenderingContext.get_extension. So from web-sys api not instantiated as an AngleInstanceArrays struct. Similar as this construct for WebGl2RenderingContext cast in game. The game source has a cast, which is missing for AngleInstancedArrays. Have noted this on the SO question.

jonboj avatar Jul 03 '22 07:07 jonboj