scyth3s's picture

Game.cs (quickstart) runtime error on Linux?

Info: Linux Mint 11, MonoDevelop, referenced System.Drawing and OpenTK.dll, and I (manually) copied the OpenTK.dll.config file into the exe's directory.

The code spits out a runtime error

Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for OpenTK.Graphics.GraphicsMode ---> System.PlatformNotSupportedException: Please, refer to http://www.opentk.com for more information.
at OpenTK.Platform.Factory+UnsupportedPlatform.CreateGraphicsMode () [0x00000] in :0
at OpenTK.Graphics.GraphicsMode..cctor () [0x00000] in :0
--- End of inner exception stack trace ---

What this says to me is that in the constructor

public Game()
     :base(800,600, GraphicsMode.Default, "OpenTK Quick Start Sample")

the GraphicsMode.Default is not valid on Linux Mint (based on Ubuntu). What can I do about this?


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Which video card and drivers are you using? (Paste the output of glxinfo if you are not sure).

This looks related to #2457: OpenTK not working on Ubuntu 11.04 + ATI and #2418: GameWindow not working on Ubuntu 11.04 + nVidia. Some people have reported success after installing libX11-dev or mesa-common-dev. If this is the case, then this is a matter of modifying OpenTK.dll.config to target the correct versions of libX11 or libGL (i.e. libX11.so.# or libGL.so.#).

scyth3s's picture

Oh snap... I didn't even think of that. I always forget that openGL is implemented by the graphics drivers- and guess what? Its a brand new fresh install. No drivers. I'll be testing that out ASAP! Thanks for the hint.

Edit: Well, I tried getting the drivers. Apparently the newest release of Linux Mint has some issues with the Nvidia driver... A full verdict on that will probably take a while :/

puklaus's picture

Well, linux comes with mesa and open source graphics adapter drivers, so opengl programs should work right away (and works great and fast, even shaders).
You installed libx11-dev packet from repo?

scyth3s's picture

That worked.

this.GiveMoneyTo(puklaus, 25.00f);

You have made me very happy!

tksuoran's picture

Why exactly does running OpenTK application need a dev package? It sounds a bit funny that end users would need to install dev package just to run something.

puklaus's picture

Installed fresh xubuntu in VM again, and found the problem:
there is missing libX11.so -file (in /usr/lib/i386-gnu/), there is only libX11.so.6.
So making a link:
sudo ln libX11.so.6 libX11.so
(in that right directory), fixes that problem..

tksuoran's picture

Is this something that could be fixed in OpenTK.dll.config or mono's dll maps?

the Fiddler's picture

Yes, you can handle this through a dllmap in OpenTK.dll.config.

The problem is that different distros appear to use slightly different naming schemes (why is the libX11.so symlink missing in Ubuntu unless you install the -dev package?) Anyone knows what suse/opensuse and redhat/fedora use? We might be able to find some common ground and make this work out of the box.