devin12's picture

X11/Ubuntu x64 Woes

Hi everyone,

I have OpenTK running under Vistax64 with no trouble at all. I'm now trying the example programs under linux. The GameWindow based samples run fine, but the winform control ones crash immediately with a bad context error.

Some details:

mono --version
Mono JIT compiler version 2.0.1 (tarball)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
	TLS:           __thread
	GC:            Included Boehm (with typed GC)
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none

The error in debug.log:

Creating default GraphicsMode (24, 16, 0, 0, 0, 2, False).
Bits per pixel: 24
Depth: 16
Display: 47642432, Screen: 0, RootWindow: 478
Getting FB config.
Bits per pixel: 24
Depth: 16
Falling back to glXChooseVisual.
Creating GraphicsContext.
    GraphicsMode: Index: 35, Color: 32 (8888), Depth: 24, Stencil: False, Samples: 0, Accum: 0 ( indexed), Buffers: 2, Stereo: False
    IWindowInfo: X11.WindowInfo: Display 35371232, Screen 0, Handle 48236088, Parent: (null)
    Creating X11GLContext context: direct, not shared... 
    Creating temporary context to load GLX extensions.
    Load extensions for OpenTK.Platform.X11.Glx... 2 extensions loaded in 2 ms.
    Using legacy context creation... failed. Trying direct: False... 
    Context created (id: 48200632).
    Warning: Context is not direct.
Making context 48200632 current on thread 1 (Display: 35371232, Screen: 0, Window: 48236088)... System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> OpenTK.Graphics.GraphicsContextException: Failed to make context current.
  at OpenTK.Platform.X11.X11GLContext.MakeCurrent (IWindowInfo window) [0x000e3] in /media/disk/Subversion/CodeBank/opentk/Source/OpenTK/Platform/X11/X11GLContext.cs:226 
  at OpenTK.Graphics.GraphicsContext.MakeCurrent (IWindowInfo info) [0x00000] in /media/disk/Subversion/CodeBank/opentk/Source/OpenTK/Graphics/GraphicsContext.cs:373 
  at OpenTK.GLControl.MakeCurrent () [0x00000] in /media/disk/Subversion/CodeBank/opentk/Source/OpenTK/GLControl.cs:189 
  at OpenTK.GLControl.OnHandleCreated (System.EventArgs e) [0x0003b] in /media/disk/Subversion/CodeBank/opentk/Source/OpenTK/GLControl.cs:113 
  at System.Windows.Forms.Control.WmCreate (System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.ContainerControl.WndProc (System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.UserControl.WndProc (System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] 
  at System.Windows.Forms.XplatUIX11.SendMessage (IntPtr hwnd, Msg message, IntPtr wParam, IntPtr lParam) [0x00000] 
  at System.Windows.Forms.XplatUIX11.CreateWindow (System.Windows.Forms.CreateParams cp) [0x00000] 
  at System.Windows.Forms.XplatUI.CreateWindow (System.Windows.Forms.CreateParams cp) [0x00000] 
  at System.Windows.Forms.NativeWindow.CreateHandle (System.Windows.Forms.CreateParams cp) [0x00000] 
  at System.Windows.Forms.Control.CreateHandle () [0x00000] 
  at System.Windows.Forms.Control.CreateControl () [0x00000] 
  at OpenTK.GLControl..ctor (OpenTK.Graphics.GraphicsMode mode, Int32 major, Int32 minor, GraphicsContextFlags flags) [0x0007b] in /media/disk/Subversion/CodeBank/opentk/Source/OpenTK/GLControl.cs:86 
  at OpenTK.GLControl..ctor (OpenTK.Graphics.GraphicsMode mode) [0x00000] in /media/disk/Subversion/CodeBank/opentk/Source/OpenTK/ColorMode.cs:1 
  at OpenTK.GLControl..ctor () [0x00000] in /media/disk/Subversion/CodeBank/opentk/Source/OpenTK/ColorMode.cs:1 
  at (wrapper remoting-invoke-with-check) OpenTK.GLControl:.ctor ()
  at Examples.WinForms.W01_First_Window.InitializeComponent () [0x00021] in /media/disk/Subversion/CodeBank/opentk/Source/Examples/WinForms/W01_First_Window.Designer.cs:34 
  at Examples.WinForms.W01_First_Window..ctor () [0x0000d] in /media/disk/Subversion/CodeBank/opentk/Source/Examples/WinForms/W01_First_Window.cs:29 
  at (wrapper remoting-invoke-with-check) Examples.WinForms.W01_First_Window:.ctor ()
  at Examples.WinForms.W01_First_Window.Main () [0x00000] in /media/disk/Subversion/CodeBank/opentk/Source/Examples/ExampleAttribute.cs:1 
  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 () [0x0004d] in /media/disk/Subversion/CodeBank/opentk/Source/Examples/ExampleLauncher.cs:159

Thanks for any help, and great job on the library so far.


Comments

Comment viewing options

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

Can you also list your video card & drivers? Also, which OpenTK version are you using?

I'll reboot into Ubuntu and try to reproduce.

devin12's picture

Hi, I guess that info would help too lol, sorry.

O.S. Version:
Ubuntu Jaunty 9.04 amd64

Graphics Card and Driver:
2 NVIDIA 8800M GTX in SLI with the 180.44 driver compiled from source off of NVIDIA's website

OpenTK Lib:
Latest update from the subversion server

I'm compiling it using monodevelop, the same error happens in both debug and release mode. I also get an error whenever a sample tries to load a vertex buffer, I'll post those details here as soon as I get to my laptop to reproduce them.

Thanks!

objarni's picture

Off-topic but: how does Ubuntu 9.04 compare to 8.10? Is the boot time noticeably faster? Any changes to desktop interface or something?

devin12's picture

I can't compare it to 8.10 but it seems a bit snappier than 8.04. They have some minor user interface improvements, but I went to 9.04 because of the improved networkmanager and native support for the troublesome rt2860 network chip(I also clobbered my 8.04 on accident, hehe). Plus, it has a super sweet splash screen now at log in.

the Fiddler's picture

Thanks, I'm trying to trace the error.

Kamujin's picture
objarni wrote:

Off-topic but: how does Ubuntu 9.04 compare to 8.10? Is the boot time noticeably faster? Any changes to desktop interface or something?

I found 8.10 to be of such poor quality that I spent most of my time using Vista and Windows 7.

I am currently running 9.04 beta and I find it more stable and reliable than 8.10. Boot times are fast, pulse audio is getting better, and the new notification system is nice.

9.04 is a really nice version and worth the upgrade IMO.

Kamujin's picture

Fiddler, as I am running Ubuntu 9.04 amd64 with an nVidia Quadro 3700M, I figured I'd take a look at the winform examples myself, but they are functioning as expected for me.

devin12's picture

Little Update:

I have gotten past the bad context error, I think I had a corrupt package that the driver tried to build itself from. Even though the desktop was running accelerated, the app couldn't find openglX and would crash. Now, glxgears/blender etc are all running fine so my drivers are squared away. I'm still having trouble with the sample apps though, for instance the framerate is painfully slow, and it takes many(read 10+) clicks to change the control color in the Winforms Sample. I have also tried my own little program that is a simple .obj file loader in a winform, and its frame rate is very poor. Any ideas?

the Fiddler's picture

What do the following commands return?

glxinfo | grep direct
cat /var/log/Xorg.0.log | grep dri

Also, is your desktop in 16bit or 24bit color depth?

OpenTK could be requesting a GraphicsMode that is not hardware accelerated. In your app, try specifying different parameters to GraphicsMode, e.g. new GraphicsMode(16, 16) or new GraphicsMode(24, 16).

devin12's picture

Hi,

glxinfo | grep direct gives:

direct rendering: Yes
    GL_EXT_depth_bounds_test, GL_EXT_direct_state_access,

and cat /var/log/Xorg.0.log | grep dri:

devin@Devin-Linux:~$ cat /var/log/Xorg.0.log | grep dri
(WW) AllowEmptyInput is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
	X.Org XInput driver : 4.0
(II) "dri" will be loaded by default.
(II) "dri2" will be loaded by default.
(II) LoadModule: "dri"
(II) Loading /usr/lib/xorg/modules/extensions//libdri.so
(II) Module dri: vendor="X.Org Foundation"
(II) LoadModule: "dri2"
(II) Loading /usr/lib/xorg/modules/extensions//libdri2.so
(II) Module dri2: vendor="X.Org Foundation"
(II) Loading /usr/lib/xorg/modules/drivers//nvidia_drv.so
	ABI class: X.Org XInput driver, version 4.0
	ABI class: X.Org XInput driver, version 4.0
(II) Synaptics touchpad driver version 0.99.3

My desktop is running 1920x1200 24bit colordepth.

Thanks!