grovesNL / glow

GL on Whatever: a set of bindings to run GL anywhere and avoid target-specific code
Apache License 2.0
1.2k stars 130 forks source link

calling from_webgl2_context multiple times doesn't return the same context #285

Open vizigr0u opened 8 months ago

vizigr0u commented 8 months ago

observed behaviour

Calling glow::Context::from_webgl2_context multiple times seems to return a different context.

expected behaviour

Calling glow::Context::from_webgl2_context multiple times returns the same context every time.

This is consistent with the behaviour of the javascript getContext and with the behaviour observed in web-sys.

Repro

see this gist of drawing a triangle comparing web-sys and glow : https://gist.github.com/vizigr0u/952637d4f9b1b3bd9a6eb8e7a872a3a0

The methods render_glow and render_web_sys grab a context from an existing canvas and call draw_glow or draw_web_sys

the constant SHOWCASE_BUG will affect whether the draw methods are passed a new context or a reference.

observe that when SHOWCASE_BUG is true, draw_glow will not be displaying while draw_web_sys will work either way.

grovesNL commented 2 months ago

Hi! This isn't supported right now because of the WebGL context is currently wrapped to track/copy WebGL handles.