luca-piccioni / OpenGL.Net

Modern OpenGL bindings for C#.
MIT License
579 stars 109 forks source link

Incorrect handling of Mono on Windows #66

Closed Xyene closed 7 years ago

Xyene commented 7 years ago

Hi,

To cover all my bases, I gave my app a try under Mono's Windows implementation, and it looks like OpenGL.Net is incorrectly assuming that the presence of a Mono-specific class implies the app is running on Linux:

https://github.com/luca-piccioni/OpenGL.Net/blob/4fb157cba30989fa575db3d3787a2cc80e3513ad/OpenGL.Net.WinForms/GlControl.cs#L620

This causes the following branch to execute, and initialization to ultimately fail due to being "unable to connect to X server using XPlatUI".

https://github.com/luca-piccioni/OpenGL.Net/blob/4fb157cba30989fa575db3d3787a2cc80e3513ad/OpenGL.Net.WinForms/GlControl.cs#L622-L627

A simple solution would seem to be to only take that branch if the platform is not Windows, though I'm not sure if there are more deep-seated issues preventing OpenGL.Net from running under Windows Mono... or if this really impacts anyone.

luca-piccioni commented 7 years ago

Well, never considered Mono on Windows. It surely worth a try and see if everything is running as should be. The above commit should execute the relevant branch only on Linux platforms, as it should.