Skip to content
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

Add fallback on backends. #37

Open
Potpourri opened this issue Feb 22, 2015 · 6 comments
Open

Add fallback on backends. #37

Potpourri opened this issue Feb 22, 2015 · 6 comments

Comments

@Potpourri
Copy link
Member

Currently glfw_window and sdl2_window panics if OpenGL version not supported, glutin_window writes error, but not panics. I propose to make it customizable. Add in WindowSettings field fallback or something similar. In backends panics if is false and try to create context with default OpenGL if is true.

@bvssvni
Copy link
Member

bvssvni commented Feb 22, 2015

Perhaps we should return Result<Window, Error> from the back-ends.

@Potpourri
Copy link
Member Author

What is the minimum version OpenGL we support? We everywhere use 3.2, but 2d works well and with 2.1. It would be nice to have fallback to it.

@bvssvni
Copy link
Member

bvssvni commented Feb 22, 2015

The OpenGL version shouldn't be put in WindowSettings, because the back-end might be using DirectX or a software rasterizer. That's why it passed as first argument and WindowSettings is passed as second.

@Potpourri
Copy link
Member Author

I do not ask put OpenGL version in WindowSettings. I ask what is the minimum version OpenGL we support in piston projects? If it 3.2 and low versions we will not support, then no problem. But if we support low versions, then we need fallback or somethings else.

@Potpourri
Copy link
Member Author

Here is an example:
OpenGL = 3.2 (it passed as first argument, all as always)
fallback = true (it set in WindowSettings or passed as third argument, it does not matter)
Backend first try to create OpenGL 3.2 context. If it fail, then check fallback flag, if fallback = true, then backend prints error and creates context with maximum available OpenGL version, else if fallback = false, then backend panics or perhaps returns Err(...).
Something like currently works glutin_window, only in him this behavior is not customizable.

@bvssvni
Copy link
Member

bvssvni commented Feb 23, 2015

Ok, so the window back-end attempts to fall back on an earlier version when fallback = true. This would increase the range of hardware the application runs on and cause less problems for users.

As a first step, can we make a custom constructor per window back-end GlutinWindow::fallback(version, settings)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants