-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
glow design rationale #76
Comments
Basically the goal is to make it easy as possible to use the portable subset between OpenGL, OpenGL ES, and WebGL. We want to avoid users having to write Some of the original rationale was described in gfx-rs/gfx#2554 but the glow README definitely needs some more detail about this :)
I think it's reasonable to expose parts of the API outside that subset as platform-specific extensions as long as the user is aware that it's not portable. For example, we already started exposing some WebGL-specific functionality that doesn't exist on OpenGL or OpenGL ES. winit also has a nice approach to handle platform-specific functionality -- we might be able to apply a similar approach to glow. |
As it pertains to the design of this lib, I'm curious about ed1ca43. Was the driving force behind removing the more complex type system just to keep this crate as simple as possible? Creating a more 'Rusty' type representation fell outside of it's scope? |
@TannerRogalsky Great question :) It's difficult to say whether removing typed enums/newtypes/bitflags is the best move, but the biggest issues I noticed were:
There are probably some places where enums/bitflags are obvious improvements, but at least for now I thought it would be easier if we just kept using constants. |
I'd say the biggest loss was actually the newtypes. I recently ran into a (stupid) error which could have been caught by the compiler telling me I was trying to use a |
@rspencer01 interesting, maybe we could improve that by using newtypes inside of the associated types at Lines 84 to 95 in c5a7ec7
e.g. The web backend already does something similar. |
It introduces a bit of boilerplate and destructuring code throughout, but I would personally think it is worth it (and, as you say, no worse than the web code). |
180: Use newtypes for native GL handles r=kvark,rspencer01 a=grovesNL Fixes #178 and should help #76 (comment) Co-authored-by: Joshua Groves <[email protected]>
glow is supposed to provide
GL on Whatever
. But what is the strategy to achieve it? Being clear about the design rationale would increase trust in the project.As suggested in the comment bellow, glow only exposes a subset of the functions which are present in OpenGL, OpenGLES3 and WebGL2.
#75 (comment)
It makes sense for the project purpose, but what if we want to use platform-specific functionalities?
For instance: It's totally possible to keep track of the platform specific context, but it doesn't seem to be possible to use an OpenGL object created with glow in the original context because the object ID isn't exposed.
The text was updated successfully, but these errors were encountered: