devnull's picture

CreateContext Failure in X11

Hi there!

Although OpenTK seems to work fine within windows, I can't get it to work in a 64-bit Ubuntu environment - Neither my own code, nor the OpenTK examples will work. I'm using Gnome with Compiz (emerald) being enabled; Desktop Effects, 3D and everything else is working fine.

Mono Version:

Quote:

unknown@devnull:~$ 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

Error Info:

Quote:

unknown@devnull:~/Desktop/Binaries$ mono Examples.exe
X11 Error encountered:
Error: BadValue (integer parameter out of range for operation)
Request: 135 (34)
Resource ID: 0x1454AA0
Serial: 46
Hwnd:
Control: at System.Environment.get_StackTrace()
at System.Windows.Forms.XplatUIX11.HandleError(IntPtr display, XErrorEvent ByRef error_event)
at System.Object.wrapper_native_0x7f751b2405e0(IntPtr , IntPtr , IntPtr , Boolean , System.Int32* )
at OpenTK.Platform.X11.Glx+Delegates+CreateContextAttribsARB.invoke_intptr__this___intptr_intptr_intptr_bool_int*(IntPtr , IntPtr , IntPtr , Boolean , System.Int32* )
at OpenTK.Platform.X11.Glx+Arb.CreateContextAttribs(IntPtr display, IntPtr fbconfig, IntPtr share_context, Boolean direct, System.Int32[] attribs)
at OpenTK.Platform.X11.X11GLContext..ctor(OpenTK.Graphics.GraphicsMode mode, IWindowInfo window, IGraphicsContext shared, Boolean direct, Int32 major, Int32 minor, GraphicsContextFlags flags)
at OpenTK.Platform.X11.X11Factory.CreateGLContext(OpenTK.Graphics.GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, Boolean DirectRendering, Int32 major, Int32 minor, GraphicsContextFlags flags)
at OpenTK.Platform.Factory.CreateGLContext(OpenTK.Graphics.GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, Boolean directRendering, Int32 major, Int32 minor, GraphicsContextFlags flags)
at OpenTK.Graphics.GraphicsContext..ctor(OpenTK.Graphics.GraphicsMode mode, IWindowInfo window, Int32 major, Int32 minor, GraphicsContextFlags flags)
at OpenTK.Platform.X11.X11GLNative.CreateWindow(Int32 width, Int32 height, OpenTK.Graphics.GraphicsMode mode, Int32 major, Int32 minor, GraphicsContextFlags flags, IGraphicsContext ByRef context)
at OpenTK.GameWindow..ctor(Int32 width, Int32 height, OpenTK.Graphics.GraphicsMode mode, System.String title, GameWindowFlags options, OpenTK.Graphics.DisplayDevice device, Int32 major, Int32 minor, GraphicsContextFlags flags)
at OpenTK.GameWindow..ctor(Int32 width, Int32 height, OpenTK.Graphics.GraphicsMode mode, System.String title, GameWindowFlags options, OpenTK.Graphics.DisplayDevice device)
at OpenTK.GameWindow..ctor(Int32 width, Int32 height, OpenTK.Graphics.GraphicsMode mode)
at Examples.Tutorial.T10_GLSL_Cube..ctor()
at Examples.Tutorial.T10_GLSL_Cube.Main()
at System.Reflection.MonoMethod.InternalInvoke(System.Object , System.Object[] , System.Exception ByRef )
at System.Reflection.MonoMethod.Invoke(System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
at System.Reflection.MethodBase.Invoke(System.Object obj, System.Object[] parameters)
at Examples.ExampleLauncher.RunExample()
at Examples.ExampleLauncher.runButton_Click(System.Object sender, System.EventArgs e)
at System.Windows.Forms.Control.OnClick(System.EventArgs e)
at System.Windows.Forms.Button.OnClick(System.EventArgs e)
at System.Windows.Forms.ButtonBase.OnMouseUp(System.Windows.Forms.MouseEventArgs mevent)
at System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs mevent)
at System.Windows.Forms.Control.WmLButtonUp(Message ByRef m)
at System.Windows.Forms.Control.WndProc(Message ByRef m)
at System.Windows.Forms.ButtonBase.WndProc(Message ByRef m)
at System.Windows.Forms.Button.WndProc(Message ByRef m)
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage(Message ByRef m)
at System.Windows.Forms.Control+ControlNativeWindow.WndProc(Message ByRef m)
at System.Windows.Forms.NativeWindow.WndProc(IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.XplatUIX11.DispatchMessage(MSG ByRef msg)
at System.Windows.Forms.XplatUI.DispatchMessage(MSG ByRef msg)
at System.Windows.Forms.Application.RunLoop(Boolean Modal, System.Windows.Forms.ApplicationContext context)
at System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationContext context)
at System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm)
at Examples.ExampleLauncher.Main()

X11 Error encountered:
Error: GLXBadContext
Request: 135 (4)
Resource ID: 0x5A00004
Serial: 48
Hwnd:
Control: at System.Environment.get_StackTrace()
at System.Windows.Forms.XplatUIX11.HandleError(IntPtr display, XErrorEvent ByRef error_event)
at OpenTK.Platform.X11.Functions.XGetWMNormalHints(IntPtr , IntPtr , XSizeHints ByRef , IntPtr ByRef )
at OpenTK.Platform.X11.X11GLNative.SetWindowMinMax(Int16 min_width, Int16 min_height, Int16 max_width, Int16 max_height)
at OpenTK.Platform.X11.X11GLNative.CreateWindow(Int32 width, Int32 height, OpenTK.Graphics.GraphicsMode mode, Int32 major, Int32 minor, GraphicsContextFlags flags, IGraphicsContext ByRef context)
at OpenTK.GameWindow..ctor(Int32 width, Int32 height, OpenTK.Graphics.GraphicsMode mode, System.String title, GameWindowFlags options, OpenTK.Graphics.DisplayDevice device, Int32 major, Int32 minor, GraphicsContextFlags flags)
at OpenTK.GameWindow..ctor(Int32 width, Int32 height, OpenTK.Graphics.GraphicsMode mode, System.String title, GameWindowFlags options, OpenTK.Graphics.DisplayDevice device)
at OpenTK.GameWindow..ctor(Int32 width, Int32 height, OpenTK.Graphics.GraphicsMode mode)
at Examples.Tutorial.T10_GLSL_Cube..ctor()
at Examples.Tutorial.T10_GLSL_Cube.Main()
at System.Reflection.MonoMethod.InternalInvoke(System.Object , System.Object[] , System.Exception ByRef )
at System.Reflection.MonoMethod.Invoke(System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
at System.Reflection.MethodBase.Invoke(System.Object obj, System.Object[] parameters)
at Examples.ExampleLauncher.RunExample()
at Examples.ExampleLauncher.runButton_Click(System.Object sender, System.EventArgs e)
at System.Windows.Forms.Control.OnClick(System.EventArgs e)
at System.Windows.Forms.Button.OnClick(System.EventArgs e)
at System.Windows.Forms.ButtonBase.OnMouseUp(System.Windows.Forms.MouseEventArgs mevent)
at System.Windows.Forms.Button.OnMouseUp(System.Windows.Forms.MouseEventArgs mevent)
at System.Windows.Forms.Control.WmLButtonUp(Message ByRef m)
at System.Windows.Forms.Control.WndProc(Message ByRef m)
at System.Windows.Forms.ButtonBase.WndProc(Message ByRef m)
at System.Windows.Forms.Button.WndProc(Message ByRef m)
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage(Message ByRef m)
at System.Windows.Forms.Control+ControlNativeWindow.WndProc(Message ByRef m)
at System.Windows.Forms.NativeWindow.WndProc(IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.XplatUIX11.DispatchMessage(MSG ByRef msg)
at System.Windows.Forms.XplatUI.DispatchMessage(MSG ByRef msg)
at System.Windows.Forms.Application.RunLoop(Boolean Modal, System.Windows.Forms.ApplicationContext context)
at System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationContext context)
at System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm)
at Examples.ExampleLauncher.Main()

Would appreciate any help, as I have become a friend of OpenGL after switching to *nix :)


Comments

Comment viewing options

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

What video card & drivers are you using?

I fixed a bug in context creation yesterday that might be related (OpenTK 0.9.5 was setting an invalid context attribute). Can you please checkout the latest code and check again?

Edit: Try to run the Extensions example, which creates a GL 3.0 context.

devnull's picture

Retrieved and built it myself from the latest SVN, and everything seems to work - Thank you :)

Just for your information:
OS: Ubuntu 9.04 Jaunty Alpha; Gnome + Compiz
Graphiccard: NVIDIA Geforce 9800 GT
Driver: NVIDIA driver (ver. 180)

the Fiddler's picture

Great!

bkrogh's picture

I had an error similar to what devnull described above. Using the SVN sources removes the bug here too.

OS: Gentoo, mono 2.2-r4
GFX: NVIDIA Quadro 140NVS
Driver: 185.13

Thanks for the great work. I really think OpenTK has a lot of promise!