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

More graceful way to see if OpenGL is supported or not #112

Open
MikaelStalvik opened this issue Aug 6, 2023 · 1 comment
Open

More graceful way to see if OpenGL is supported or not #112

MikaelStalvik opened this issue Aug 6, 2023 · 1 comment
Labels
4.0 enhancement New feature or request

Comments

@MikaelStalvik
Copy link

When trying to initialize the GLWpfControl on a device (VirtualBox for example) which does not support OpenGL, a hard exception is thrown: "OpenTK.Windowing.GraphicsLibraryFramework.GLFWException: WGL: The driver does not appear to support OpenGL"

Stack trace
OpenTK.Windowing.GraphicsLibraryFramework.GLFWException: WGL: The driver does not appear to support OpenGL at OpenTK.Windowing.Desktop.GLFWProvider.<>c.<.cctor>b__10_0(ErrorCode errorCode, String description) at OpenTK.Windowing.GraphicsLibraryFramework.GLFWNative.glfwCreateWindow(Int32 width, Int32 height, Byte* title, Monitor* monitor, Window* share) at OpenTK.Windowing.GraphicsLibraryFramework.GLFW.CreateWindow(Int32 width, Int32 height, String title, Monitor* monitor, Window* share) at OpenTK.Windowing.Desktop.NativeWindow..ctor(NativeWindowSettings settings) at OpenTK.Wpf.DxGlContext.GetOrCreateSharedOpenGLContext(GLWpfControlSettings settings) at OpenTK.Wpf.DxGlContext..ctor(GLWpfControlSettings settings) at OpenTK.Wpf.GLWpfControlRenderer..ctor(GLWpfControlSettings settings) at OpenTK.Wpf.GLWpfControl.Start(GLWpfControlSettings settings) at MyApp.UserControls.ShaderUserControl.InitControl()

Feature request
Could it be possible to add a method that can check if OpenGL is supported or not, which can be invoked prior to the GLWpfControl.Start call to more gracefully handle devices that does not support OpenGL?

@NogginBops
Copy link
Member

Generally there isn't really a good way to check in advance if OpenGL is supported for a particular combination of OpenGL versions and profile flags other than just trying to create an OpenGL window.

So to create a way to probe for OpenGL in advance would basically involve creating a window and seeing if it works or not. This could add some startup time, but might be considered acceptable if the application requires it.

I'm guessing it's hard to catch the exception in Start()? I'm not too well versed in Wpf so I'm not sure where the preferred place to check for these kinds of initialization errors is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.0 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants