-
Notifications
You must be signed in to change notification settings - Fork 52
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
OpenGL support #5
Comments
Why does it need to be a feature? |
Honestly... I forget. I wrote this down right after the meeting last week because, I think it was @Osspial who said that extra info was needed for GL but not all the time. Or perhaps it was @kvark who said that gfx-backend-gl needed the extra info of some sort to fully disconnect from directly interacting with |
Yes, I was the one. OpenGL can't work off a platform-independent window (like other APIs), because the ways to create OpenGL context on many platforms are tightly integrated with window creation. So if you have a window, and it doesn't happen to have a GL context established, there is no way to build one based on the window. Therefore, this crate can have a bit of API exposing raw GL contexts in addition to the windows. |
Is this necessary, actually? I've done a significant amount of OpenGL programming, and as long as the OpenGL context is active and there's a way for the OpenGL wrapper to get handles to the proper function pointers you can render to OpenGL just fine. |
@Osspial right, so if GL context is created and active, and nothing touches it or tries to access it from different threads, we are good. What if there are 2 windows? The user of raw-window-handle would then become responsible for managing the GL contexts. I.e. the user passes the window handle to a library, and suddenly they need to know precisely where and when the library is going to need that active GL context... |
I think it would be fine if you just exposed a trait that did stuff like |
@kvark that... sounds like the status quo. I don't mean to say that we shouldn't try to improve on that, but we've had ample opportunity to move context management away from the user and I haven't seen any progress in that direction. Honestly, I don't like the idea of adding those features, both from an ideological and technical standpoint:
|
@Osspial so we come down to something I mentioned previously - "raw-gl-context" library, which would be independent of this one. Library would abstract away GL context details of glfw/sdl/glutin/etc.
FYI, I started that work in rust-windowing/glutin#942 |
@kvark I'd be entirely fine with having a |
Just a note here that OpenGL requires additional info than just the window pointer for proper context creation, so we'll have to be sure to add that as a cargo feature (off by default).
The text was updated successfully, but these errors were encountered: