triton's picture

OpenTK Linux (GLControl?) problem

So I was trying to port my small game to Linux. I am running Ubuntu 9.04 inside VirtualBox with virtualized GL hardware acceleration. I compiled the solution with MonoDevelop, everything compiles fine, but it fires an exception once I run it. I'm using OpenTK 0.9.7 (tried with 0.9.8 too) and Mono 2.4 (tried with 2.0 too). OpenTK samples seem to run fine. By the way, it's using the OpenTK GLControl.

Here is the exception information:

triton@triton-laptop:~/Projects/Tyrian/src/Tyrian/bin/Debug$ mono Tyrian.exe
OpenGL Warning: XGetVisualInfo returned 0 visuals for 972c308
 
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at cg.CgLibControl.OnResize (System.EventArgs e) [0x00000] 
  at System.Windows.Forms.Control.OnSizeChanged (System.EventArgs e) [0x00000] 
  at System.Windows.Forms.Control.UpdateBounds (Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight) [0x00000] 
  at System.Windows.Forms.Control.UpdateBounds (Int32 x, Int32 y, Int32 width, Int32 height) [0x00000] 
  at System.Windows.Forms.Control.SetBoundsCoreInternal (Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified) [0x00000] 
  at System.Windows.Forms.Control.SetBoundsCore (Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified) [0x00000] 
  at System.Windows.Forms.Control.SetBoundsInternal (Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified) [0x00000] 
  at System.Windows.Forms.Control.SetBounds (Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified) [0x00000] 
  at System.Windows.Forms.Control.ScaleControl (SizeF factor, BoundsSpecified specified) [0x00000] 
  at System.Windows.Forms.ScrollableControl.ScaleControl (SizeF factor, BoundsSpecified specified) [0x00000] 
  at System.Windows.Forms.Control.Scale (SizeF factor) [0x00000] 
  at System.Windows.Forms.ContainerControl.PerformAutoScale (Boolean called_by_scale) [0x00000] 
  at System.Windows.Forms.ContainerControl.PerformAutoScale () [0x00000] 
  at System.Windows.Forms.ContainerControl.PerformDelayedAutoScale () [0x00000] 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.ContainerControl:PerformDelayedAutoScale ()
  at System.Windows.Forms.Control.ResumeLayout (Boolean performLayout) [0x00000] 
  at cg.CgLibControl.InitializeComponent () [0x00000] 
  at cg.CgLibControl..ctor () [0x00000] 
  at (wrapper remoting-invoke-with-check) cg.CgLibControl:.ctor ()
  at cg.Application.Run (Int32 fps, System.Windows.Forms.Control parentControl) [0x00000] 
  at Tyrian.GameApp.Run (Int32 fps, Size sz) [0x00000] 
  at Tyrian.Tyrian.Main () [0x00000] 
triton@triton-laptop:~/Projects/Tyrian/src/Tyrian/bin/Debug$ glxgears 
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0"
      after 1748 requests (1747 known processed) with 0 events remaining.

If someone got any suggestions, please tell! :)


Comments

Comment viewing options

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

Impossible to tell without seeing the code, but you are probably accessing some field before it is initialized.

Fortunately, MonoDevelop 2.0 comes with a debugger (sudo apt-get install monodevelop-debugger-mdb, IIRC). Compile and run in debug mode and you'll get a stacktrace and a breakpoint at exact location of the NRE. You can also set breakpoints manually and inspect the state of your fields and local variables.