ChrisSwan's picture

Debugging advice for OpenTK on Raspberry Pi

Hi,

I'm having a go at getting OpenTK (and then MonoGame) working on the Raspberry Pi. The device comes with a standard Linux implementation of OpenGLES 2.0 and Mono seems to run ok, so in theory this should work (I think!).

I have a Debian image, and the last stable OpenTk.sln (from opentk-2010-10-06.zip) compiles on Pi using Mono straight away without errors. However when running Example.exe through the desktop and clicking on Simple ES 2 example I get a runtime crash on graphics initialization.

My problem is debugging this issue. The current desktop on Pi is too slowto run MonoDevelop so I'm having to resort to adding Console.WriteLine() to the code and then waiting for an hour for it to recompile and run.

It's proving quite tricky just staring at the code and thinking through where it's going (I can see how the ES2 example is invoked but it then seems to bounce around mulitple GraphicsMode constructors which is where I'm getting lost), so if anyone has advice on where to start littering the code with WriteLines() and what to look out for that would be hugely appreciated.

Or if people have any other advice on how I could go about debugging this that would be great too. I've been told about using gdb to debug from the terminal, but my linux skills are pretty weak and it might take a while to get the hang of that.

I've pasted the crash output below in case it of any help, and many thanks in advance.

Detected configuration: Linux / Mono
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> 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 <filename unknown>:0
  at OpenTK.Graphics.GraphicsMode..cctor () [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Examples.Tutorial.SimpleES20Window..ctor () [0x00000] in <filename unknown>:0
  at Examples.Tutorial.SimpleES20Window.Main () [0x00000] in <filename unknown>:0
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
        System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
        System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at Examples.ExampleBrowser+<RunSample>c__AnonStorey1.<>m__0 () [0x00000] in <filename unknown>:0