opentk / GLWpfControl

A fast native control for OpenTK 4.x + 3.x on WPF.
MIT License
194 stars 48 forks source link

'The specified window isn't an OpenGL window' error on x64 .net framework #103

Closed chenxuuu closed 1 year ago

chenxuuu commented 1 year ago

OpenTK.GLWpfControl 3.3.0
OpenTK 3.3.1 .net framework 4.6.2、4.5.2

x86 target works well, but x64 target crash at OpenTkControl.Start(settings);

OpenTK.Graphics.GraphicsContextException:“The specified window isn't an OpenGL window”

test with readme codes, whole project: TestGLWpfControl.zip

NogginBops commented 1 year ago

This error message seems related to SDL, so something seems to be going wrong in the SDL backend. Could ìt be that the SDL dll in your project is only compiled for x86?

chenxuuu commented 1 year ago

where is SDL dll? I didn't see it

NogginBops commented 1 year ago

That is interesting, from some source you are getting a SDL dll.

Could you try manually updating to OpenTK 3.3.3? You just download that version from nuget and it should work

chenxuuu commented 1 year ago

OpenTK 3.3.3 dosen't work too

I search all files in my computer, I found some sdl.dll but no one in my path environment variable

NogginBops commented 1 year ago

Doesn't need to be in path for dll search to find it, what folders did you find sdl dlls in? Anything related to your project?

chenxuuu commented 1 year ago

I found an SDL2.dll in msys2\mingw64\bin which is in my PATH environment variable
I remove it and restart vs, same error..

chenxuuu commented 1 year ago

yes, it is caused by sdl2.dll in my msys folder 图片

how to avoid this? and, why is the loading priority of this dll higher? if we can't avoid, how to detect this problem on user's pc?

chenxuuu commented 1 year ago

fixed by set path to an empty string:

Environment.SetEnvironmentVariable("path", "");