Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd a Glow device abstraction #243
Conversation
This implements GLOW (GL on Whatever) implementation of the device abstraction. It is a very close copy of the GL implementation. This abstraction can be used in multiple environments (Open GL, OpenGL ES, and WebGL) and avoid target-specific code. This can be used with wasm32-unknown-unknown + web-sys, stdweb, and natively. I wrote this to enable limited WebGL 2 + wasm32-unknown-unknown support. This also makes minor changes to shaders so that they work in WebGL 2 and implements an example that works both in web browsers and natively, via SDL.
f2f4ee2
to
7652461
|
Is GLOW the emerging consensus for Rust OpenGL programs? I'd like to make sure that Pathfinder follows whatever the Rust ecosystem is doing and not splinter off into its own GL bindings. (WebRender unfortunately is tied to |
| name = "pathfinder_glow" | ||
| version = "0.1.0" | ||
| edition = "2018" | ||
| authors = ["Patrick Walton <pcwalton@mimiga.net>", "Joshua Netterfield <joshua@nettek.ca"] |
This comment has been minimized.
This comment has been minimized.
| /// wasm32-unknown-unknown does not have a filesystem. | ||
| /// | ||
| /// This does not have any platform dependencies, but will result in larger binaries, and slower | ||
| /// compile times, so you may wish to implement an approach with different trade-offs. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
jnetterf
Dec 1, 2019
Author
Yes. This is likely something you would want to do outside of a minimal example. I'll explicitly mention this option in the comment. It may also be nice to provide such a loader in the future.
There are two reasons we may wish to avoid using a web API in this example. First, it's target-specific code that is not core to the example. Secondly, it requires a fair bit of setup, making the example harder to follow along with.
What do you think?
This comment has been minimized.
This comment has been minimized.
pcwalton
Dec 1, 2019
Collaborator
Well, my main concern is that it hardcodes all the pathnames of resources, which adds some maintenance burden.
|
Also, we should just remove |
I don't have any special information, but I think it may be too early to describe GLOW as the "emerging consensus". While new, it is the most (only?) promising approach I've seen that supports both web-sys and native GL pointers. Note that for the native bindings, glow uses gl_generator, a part of the gl-rs crate pathfinder_gl uses. GLOW is a fairly light wrapper around those bindings, which made porting the gl device abstraction to glow straightforward. My understanding is that if another thin gl abstraction becomes a consensus, it would not be hard to again switch over to that.
That makes sense, but I would suggest defering that so that you and others can raise issues that may arise with the glow device abstraction. |
|
Closing in favour of https://github.com/s3bk/pathfinder |
jnetterf commentedNov 30, 2019
•
edited
This implements GLOW (GL on Whatever) implementation of the device
abstraction. It is a very close copy of the GL implementation.
This abstraction can be used in multiple environments (Open GL, OpenGL
ES, and WebGL) and avoids target-specific code. The abstraction can be
used with wasm32-unknown-unknown + web-sys, stdweb, and natively.
I wrote this to enable limited WebGL 2 + wasm32-unknown-unknown support.
This also makes minor changes to shaders so that they work in WebGL 2
and implements an example that works both in web browsers and natively,
via SDL.