-
Notifications
You must be signed in to change notification settings - Fork 57
Add GlutinSurface::new_gl33_with_builders
#564
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
base: master
Are you sure you want to change the base?
Add GlutinSurface::new_gl33_with_builders
#564
Conversation
|
So your new function doesn’t set the actual context? It relies on the client setting it, right? That’s not super sound, it’s super easy to mess up and forget which context to use. |
| ) -> Result<Self, GlutinError> { | ||
| let windowed_ctx = context_builder.build_windowed(window_builder, &event_loop)?; | ||
|
|
||
| let ctx = unsafe { windowed_ctx.make_current().map_err(|(_, e)| e)? }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new function sets the context here. Not sure what you mean in your comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, the OpenGL 3.3 context. Here if the cliente doesn’t call the right function .with_gl etc.), it will not work as intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, if you'd like, you can override the code's choice by calling .with_gl(GlRequest::Specific(Api::OpenGl, (3, 3))).with_gl_profile(GlProfile::Core) on the passed-in builder, but as it stands, it's impossible to set other useful options on the context, like vsync or srgb, or use an event loop with a generic type, because luminance needlessly takes control over those parts of the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So an example of creating a GLFW window, people don’t have to think about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the PR to set the context version and profile explicitly, and rebased to master.
ce6ff87 to
82abd96
Compare
8c51f5e to
99a3615
Compare
This is a constructor of `GlutinSurface` that allows the `EventLoop`, `WindowBuilder`, and `ContextBuilder` to be passed in and thus configured by the user (In particular, the existing constructors do not allow passing in an `EventLoop`). To ensure the context matches what luminance needs, the context is forced to OpenGL version 3.3 core profile.
99a3615 to
b478683
Compare
This is a constructor of
GlutinSurfacethat allows theEventLoop,WindowBuilder, andContextBuilderto be passed in and thus configured by the user (In particular, the existing constructors do not allow passing in anEventLoop).