djlawler's picture

Should OpenTK work if you use an external xserver?

I am working on a program in IronPython/OpenTK that runs well on Windows. It also seems to run pretty well on a vmware/Ubuntu 8.04 machine (after I compiled the most recent version of mono on it). Out of idle curiosity I tried to connect to the vm with Cygwin/X and Xming and run the program and in all cases it dies quickly with the following message:

Traceback (most recent call last):
File OpenTK, line unknown, in .cctor
File mscorlib, line unknown, in get_Item
File OpenTK, line unknown, in .cctor
File pyBzEdit, line unknown, in Initialize
File OpenGlForm, line unknown, in __init__
File OpenGlForm, line unknown, in InitializeComponent
File OpenTK, line unknown, in .ctor
File OpenTK, line unknown, in get_Default
SystemError: An exception was thrown by the type initializer for OpenTK.Graphics.DisplayDevice

Is this expected behavior? If not I would be happy to dig into this a bit more deaply. If so, not a big deal...just wondering!

Happy New Year and thanks for a great project!

David


Comments

Comment viewing options

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

In theory it should work, but I've never tested with a remote xserver. It might be getting confused with platform detection.

Can you rerun the application with a debug version of opentk? The extra output should give a clue as to what is going wrong. You can use the debug dll from opentk 0.9.1 or recompile with mono for better results (just head to Build/ and execute mono Build.exe mono debug. You'll also need nant.)

kanato's picture

I tried this myself, and got the following stacktrace. It looks like there is a failure in the static X11XrandrDisplayDevice constructor. I tried throwing some debug information in there, but I wasn't getting any output.

Launching example: Examples.Tutorial.T03_Immediate_Mode_Cube
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.DisplayDevice ---> System.TypeInitializationException: An exception was thrown by the type initializer for OpenTK.Platform.X11.X11XrandrDisplayDevice ---> System.ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
at System.Collections.Generic.List`1[System.Object].get_Item (Int32 index) [0x00000]
at OpenTK.Platform.X11.X11XrandrDisplayDevice..cctor () [0x00000]
--- End of inner exception stack trace ---
at OpenTK.Graphics.DisplayDevice..cctor () [0x00000]
--- End of inner exception stack trace ---
at OpenTK.Graphics.GraphicsMode.get_Default () [0x00000]
at OpenTK.Graphics.GraphicsMode..ctor (ColorFormat color, Int32 depth) [0x00000]
at Examples.Tutorial.T03_Immediate_Mode_Cube..ctor () [0x00000]
at Examples.Tutorial.T03_Immediate_Mode_Cube.Main () [0x00000]
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]
--- 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]
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000]
at Examples.ExampleLauncher.RunExample () [0x00000]