add default methods to WindowOpenOptions#224
Conversation
| /// If provided, then an OpenGL context will be created for this window. You'll be able to | ||
| /// access this context through [crate::Window::gl_context]. | ||
| /// | ||
| /// By default this is set to `Some(GlConfig::default())`. |
There was a problem hiding this comment.
Why default to Some(GlConfig::default())? It makes a lot more sense to me for it to default to None.
There was a problem hiding this comment.
If the user is using a GUI library that expects OpenGL, then the GUI would fail to open with the default settings.
Though I suppose the GUI library layer could add the OpenGL config itself. So I guess either method is fine.
There was a problem hiding this comment.
I don't think we should be trying to guess what GUI libraries expect. Some GUI libraries may be using wgpu or software rendering, in which case defaulting to creating an OpenGL context will also cause problems. gl_config should default to None, and either the user or the GUI library should explicitly set it to something else if needed.
|
Alright, I made |
prokopyl
left a comment
There was a problem hiding this comment.
I agree it makes more sense to not create an OpenGL context by default. With this change done this looks good to me!
This will fix an annoying issue I'm having in my NIH-plug fork where rust-analyzer will get confused when some crates use the "opengl" feature and some don't. I have to add special crate features just to work around it.
With this, I can just use the
..Default::default()pattern to make both rust-analyzer and the rust compiler happy.