kaifello's picture

X11XrandrDisplayDevice on Xming ---> Argument is out of range.

Project:The Open Toolkit library
Version:0.9.9-2b
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Unhandled Exception: 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[OpenTK.Graphics.DisplayResolution].get_Item (Int32 index) [0x00000]
at OpenTK.Platform.X11.X11XrandrDisplayDevice..cctor () [0x00000]
--- End of inner exception stack trace ---
at OpenTK.Platform.X11.X11Factory.CreateDisplayDeviceDriver () [0x00000]
at OpenTK.Platform.Factory.CreateDisplayDeviceDriver () [0x00000]
at OpenTK.Graphics.DisplayDevice..cctor () [0x00000]
--- End of inner exception stack trace ---
at OpenTK.Graphics.GraphicsMode.get_Default () [0x00000]
at OpenTK.GLControl..ctor () [0x00000]
at (wrapper remoting-invoke-with-check) OpenTK.GLControl:.ctor ()
at OpenGLDemo.MainForm.InitializeComponent () [0x0000b] in /home/kaif/opengl_demo2/MainForm.Designer.cs:32
at OpenGLDemo.MainForm..ctor () [0x00026] in /home/kaif/opengl_demo2/MainForm.cs:28
at (wrapper remoting-invoke-with-check) OpenGLDemo.MainForm:.ctor ()
at OpenGLDemo.Program.Main () [0x0000b] in /home/kaif/opengl_demo2/Program.cs:19

$ xrandr
Screen 0: minimum 1680 x 1050, current 1680 x 1050, maximum 1680 x 1050
default connected 1680x1050+0+0 0mm x 0mm
1680x1050 0.0*

What's wrong?


Comments

Comment viewing options

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

#1

Assigned to:kaifello» Anonymous
the Fiddler's picture

#2

Need more information to find out the cause of this issue: What video card and drivers are you using? Is your monitor a TFT? Do you have multiple monitors connected?

Can you please run your application using a debug version of OpenTK.dll and attach the new stack trace? You can use MonoDevelop to compile OpenTK.sln (found in the Build/ directory of the 0.9.8-2 release). This should give exact line numbers and will help pinpoint the error.

It seems that your monitor is not reporting a refresh rate (0.0) but this should not cause problems for OpenTK - unless there is a bug in the resolution detection code.

kaifello's picture

#3

Hello!

I'm using OpenTK libraries on Linux, and start application on Windows XP using Xming. If I started application on Linux+Linux, or Windows+Windows everithing allright.
On my notebook (Toshiba Sattelite p100) I'm using GeForce Go 7900 GS with ForceWare 84.00.

the Fiddler's picture

#4

This is not a supported configuration and I am rather surprised that the library made it so far! If I may ask, why would you run the program on Windows through an X server instead of natively?

Are you using the Mono runtime for Windows?

the Fiddler's picture

#5

Status:open» in progress (review)

Ok, I have added a potential workaround on the 0.9.8-2 branch. Can you please check whether it is working for you now?

You will have to check out from svn and compile OpenTK using MonoDevelop:

svn co https://opentk.svn.sourceforge.net/svnroot/opentk/branches/0.9.8 opentk-0.9.8-svn
cd opentk-0.9.8-svn/Build
mono Build.exe vs
monodevelop OpenTK.sln &

Remove the existing OpenTK.dll from your project and add the new one you just compiled.

kaifello's picture

#6

Because of I have no Linux on my notebook. But my application must be crossplatformed (and using X server also). Sorry for my bad english :)
Thank you, I will try new version.

the Fiddler's picture

#7

You can compile the same way on windows:

  1. checkout the latest version from SVN (instructions)
  2. go to the Build/ folder and double click Build.exe; type "vs" to create a visual studio solution
  3. open the solution (OpenTK.sln in the same folder) and compile it through visual studio
the Fiddler's picture

#8

Title:OpenTK.Platform.X11.X11XrandrDisplayDevice ---> System.ArgumentOutOfRangeException: Argument is out of range.» X11XrandrDisplayDevice on Xming ---> Argument is out of range.

(Shortening title because it overflowed the recent activity box)

kaifello's picture

#9

Yes, now it work, but a little time:) After 5-6 seconds it fall. (OpenTK.Graphics.OpenGLErrorException: StackOverflow :)

./run-gui
X11 Error encountered:
Error: GLXUnsupportedPrivateRequest
Request: 143 (16)
Resource ID: 0x10000
Serial: 196
Hwnd:
Control: at System.Environment.get_StackTrace() in /home/kaif/distrib/mono-2.4/mcs/class/corlib/System/Environment.cs:line 202
at System.Windows.Forms.XplatUIX11.HandleError(IntPtr display, XErrorEvent ByRef error_event) in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:line 1987
at System.Windows.Forms.XplatUIX11.XGetWindowProperty(IntPtr , IntPtr , IntPtr , IntPtr , IntPtr , Boolean , IntPtr , IntPtr ByRef , Int32 ByRef , IntPtr ByRef , IntPtr ByRef , IntPtr ByRef )
at System.Windows.Forms.XplatUIX11.get_VirtualScreen() in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:line 2392
at System.Windows.Forms.XplatUI.get_VirtualScreen() in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs:line 417
at System.Windows.Forms.SystemInformation.get_VirtualScreen() in /home/kaif/distrib/mono-2.4/mcs/build/common/Consts.cs:line 1
at System.Windows.Forms.Screen..cctor() in /home/kaif/distrib/mono-2.4/mcs/build/common/Consts.cs:line 1
at System.Windows.Forms.Hwnd.GetNextStackedFormLocation(System.Windows.Forms.CreateParams cp, System.Windows.Forms.Hwnd parent_hwnd) in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs:line 863
at System.Windows.Forms.Hwnd.GetNextStackedFormLocation(System.Windows.Forms.CreateParams cp, System.Windows.Forms.Hwnd parent_hwnd) in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Hwnd.cs:line 834
at System.Windows.Forms.XplatUIX11.CreateWindow(System.Windows.Forms.CreateParams cp) in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:line 2737
at System.Windows.Forms.XplatUI.CreateWindow(System.Windows.Forms.CreateParams cp) in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs:line 504
at System.Windows.Forms.NativeWindow.CreateHandle(System.Windows.Forms.CreateParams cp) in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:line 166
at System.Windows.Forms.Control.CreateHandle() in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:line 4504
at System.Windows.Forms.Form.CreateHandle() in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:line 1990
at System.Windows.Forms.Control.CreateControl() in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:line 3781
at System.Windows.Forms.Control.SetVisibleCore(Boolean value) in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:line 5075
at System.Windows.Forms.Form.SetVisibleCore(Boolean value) in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:line 2451
at System.Windows.Forms.Control.set_Visible(Boolean value) in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:line 3433
at System.Windows.Forms.Application.RunLoop(Boolean Modal, System.Windows.Forms.ApplicationContext context) in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:line 862
at System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationContext context) in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:line 761
at System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm) in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:line 740
at OpenGLDemo.Program.Main() in /home/kaif/opengl_demo2/Program.cs:line 19

OpenTK.Graphics.OpenGLErrorException: StackOverflow
at OpenTK.Graphics.GraphicsContext.CheckErrors () [0x00000]
at OpenTK.Graphics.ErrorHelper.Dispose () [0x00000]
at OpenTK.Graphics.GL.PushMatrix () [0x00000]
at OpenGLDemo.MainForm.DrawMyObjects () [0x0029b] in /home/kaif/opengl_demo2/MainForm.cs:147
at OpenGLDemo.MainForm.Draw () [0x0012c] in /home/kaif/opengl_demo2/MainForm.cs:186
at OpenGLDemo.MainForm.glControl1_Paint (System.Object sender, System.Windows.Forms.PaintEventArgs e) [0x00017] in /home/kaif/opengl_demo2/MainForm.cs:263
at System.Windows.Forms.Control.OnPaint (System.Windows.Forms.PaintEventArgs e) [0x0001c] in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:6423
at OpenTK.GLControl.OnPaint (System.Windows.Forms.PaintEventArgs e) [0x00000]
at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x0008a] in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5561
at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x0016c] in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:5319
at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs:807
at System.Windows.Forms.ContainerControl.WndProc (System.Windows.Forms.Message& m) [0x0003d] in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ContainerControl.cs:642
at System.Windows.Forms.UserControl.WndProc (System.Windows.Forms.Message& m) [0x00037] in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/UserControl.cs:150
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:234
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:215
at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00085] in /home/kaif/distrib/mono-2.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs:242

the Fiddler's picture

#10

Version:0.9.8-2» 0.9.x-dev
Status:in progress (review)» fixed

Ok, marking as fixed.

The StackOverflow error typically means that you are calling PushMatrix more often than PopMatrix. The debug version of OpenTK.dll will discover and warn you about such issues automatically: it's a good idea to use the debug version while developing your application and only switch to the release dll when distributing your application.