-
Notifications
You must be signed in to change notification settings - Fork 115
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
Static loader is unsafe #185
Comments
The struct loader is unsafe too, even if we mark it as |
If you couple gl-rs with a library like glfw or glutin we can potentially build a completely safe api. // this moves the window context to be part of gl
let gl = ctx.make_current();
gl.drawElements(...);
// ect
// this unwraps the gl moving the context back into ctx
let ctx = gl.to_context(); We could supply a trait to do this conversion for you, but it requires the windowing library to work with it. |
No, because if you create multiple windows you are still unsafe. |
@tomaka the idea is that the opengl functions are queried each time you make_current. |
And how would you know that the user doesn't manually call |
@csherratt Doesn't calling |
I am leaning towards making all functions in the static loader |
I think make_current should always be unsafe. |
Agreed. |
So the |
If we define
Alternatively you could define |
Scenario:
In general, loading GL functions can be thread-specific, and only the struct loader can deal with this. Every function in the static loader should be marked unsafe, and it should be heavily discouraged.
The text was updated successfully, but these errors were encountered: