Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to glow 0.12 #711

Merged
merged 1 commit into from
Mar 3, 2023
Merged

Update to glow 0.12 #711

merged 1 commit into from
Mar 3, 2023

Conversation

Rob2309
Copy link
Contributor

@Rob2309 Rob2309 commented Feb 2, 2023

This PR intends to resolve #686.

Instead of using the std::mem::transmute workaround mentioned in several issues (e.g. grovesNL/glow#187 (comment)), I resorted to using a typesafe solution until a proper mechanism is put into place.

The way I recreate the GL objects from the raw u32 handles is to directly create new glow::Native* objects, since their inner field is public. This at least ensures that any breaking layout changes will be detected, which is not necessarily the case in the transmute() workaround.

Of course, this makes compiling for wasm completely impossible right now, but as far as I can tell, this is not possible anyway.

@Rob2309
Copy link
Contributor Author

Rob2309 commented Feb 2, 2023

I just dug into the wasm types a bit and it should probably be possible to call get_parameter() instead of get_parameter_i32(). In WebGL get_parameter returns the corresponding WebGl* objects which can by cast via dyn_into(). While requiring special code only for wasm, this would probably work.

I could test this but I don't know yet how to compile an imgui app for wasm or whether its really possible atm.

@Rob2309
Copy link
Contributor Author

Rob2309 commented Feb 3, 2023

Update: with the current glow it actually seems impossible to use the values returned from get_parameter(...) as they return the actual GL objects but the glow bind_* calls expect a key into a map of GL objects.

@dbr
Copy link
Contributor

dbr commented Mar 3, 2023

Great, thanks for this!

@dbr dbr merged commit 52820db into imgui-rs:main Mar 3, 2023
@Rob2309 Rob2309 deleted the glow-0.12 branch March 6, 2023 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update glow beyond v0.10
2 participants