loktar's picture

Cannot run sample project in VS2008

hey everyone, I'm trying to ween myself off of Tao to use openTK because I'm very interested in making some cross platform apps using C#. The problem is I try to run the quick start that comes in the download and I receive this error. I receive it on the first line of the app.

Specified argument was out of the range of valid values.\r\nParameter name: axes
at OpenTK.Input.JoystickDevice..ctor(Int32 id, Int32 axes, Int32 buttons)
at OpenTK.Input.JoystickDevice`1..ctor(Int32 id, Int32 axes, Int32 buttons)
at OpenTK.Platform.Windows.WinMMJoystick.OpenJoystick(Int32 number)
at OpenTK.Platform.Windows.WinMMJoystick..ctor()
at OpenTK.Platform.Windows.WMInput..ctor(WinWindowInfo parent)
at OpenTK.Platform.Windows.WinGLNative.OnCreate(EventArgs e)
at OpenTK.Platform.Windows.WinGLNative.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32 dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32 x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at OpenTK.Platform.Windows.WinGLNative.CreateWindow(Int32 width, Int32 height, GraphicsMode mode, IGraphicsContext& context)
at OpenTK.GameWindow..ctor(Int32 width, Int32 height, GraphicsMode mode, String title, GameWindowFlags options, DisplayDevice device)
at OpenTK.GameWindow..ctor(Int32 width, Int32 height, GraphicsMode mode, String title)
at StarterKit.Game..ctor() in D:\programs\Libraries\opentk-0.9.4\QuickStart\Game.cs:line 20
at StarterKit.Game.Main() in D:\programs\Libraries\opentk-0.9.4\QuickStart\Game.cs:line 96
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Im not sure how in the heck to fix this :? any help would be appreciated. Also as a side not all examples using the Game Window (in the examples.exe) error out for me


Comment viewing options

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

Ok, there seems to be a bug in the joystick code - which is not surprising, considering that this code is about 1 week old. OpenTK 0.9.3 should work correctly, so you can temporarily downgrade to that.

Regarding Examples.exe, the last few examples ("WinForms") do not use joystick input, so they should probably work.

Do you have a joystick/joypad connected to your computer? If yes, can you give some details? (What make, how many axes/buttons, does it have a POV hat?) You could also try disconnecting it and see if that fixes the issue.

Another thing that would help would be to compile a debug version of OpenTK and try running the Examples project again (just use the solution in the Build/ folder). This might give some clues as to what is going on.

loktar's picture

Thanks for the reply. Reverting worked. I didn't have a joystick in last night when I attempted the run. I connected one today and the same error happens. ill try the debug option that you pointed out as well to see if I can find anything further. Should of posted this in issues I suppose but just figured I wasn't doing something right and it wasn't an actual bug.

the Fiddler's picture

It seems that WinMM reports some device that looks like a joystick (but is not), confusing OpenTK . Do you have a tablet or another "exotic" input device connected to your PC?

I'll add some code to ignore devices that don't have any axes.

Edit: Committed a workaround. This issue should be fixed in the 0.9.5 release.

Edit 2: sp

loktar's picture

Yep thats exactly what it was, I have a saitek keyboard which has a separate 9 key device. It registers as a game controller, but only has 9 buttons associated with no axis.

Thanks for fixing it looking forward to 0.9.5