metatheorem's picture

All GL calls fail with NotImplementedException

Running into a problem with opentk 1.1, where all GL calls result in a NotImplementedException.

I am assuming this has to do with the new interop method described in the beta 3 release notes. This impacts my own code, and the opentk examples project as well. Tested this with beta 3 and rc 1 and have the same problem with both. This problem is not present in beta 1 and 2.

As I have just been getting to know opentk over the past month, I am not certain if this is a bug or a configuration problem on my end, and was hoping someone could offer some insight. Running Gentoo Linux on x86_64 with the proprietary nvidia drivers version 319.76, libsdl2 version 2.0.1, and mono 3.2.3.

Here is the output from running the immediate mode example:

User assembly '/mnt/personal/src/opentk-2013-12-15/Installers/Nsis/Build.Installer.Nsis.exe' is missing. Debugger will now debug all code, not just user code.
Loaded assembly: /mnt/personal/src/opentk-2013-12-15/Binaries/OpenTK/Debug/Examples.exe
Loaded assembly: /usr/lib64/mono/gac/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
Loaded assembly: /usr/lib64/mono/gac/System/2.0.0.0__b77a5c561934e089/System.dll
Loaded assembly: /usr/lib64/mono/gac/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
Loaded assembly: /usr/lib64/mono/gac/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
Loaded assembly: /usr/lib64/mono/gac/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
Loaded assembly: /usr/lib64/mono/gac/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
Loaded assembly: /usr/lib64/mono/gac/Mono.Posix/2.0.0.0__0738eb9f132ed756/Mono.Posix.dll
Loaded assembly: /mnt/personal/src/opentk-2013-12-15/Binaries/OpenTK/Debug/OpenTK.dll
Loaded assembly: /mnt/personal/src/opentk-2013-12-15/Binaries/OpenTK/Debug/OpenTK.GLControl.dll
Loaded assembly: /usr/lib64/mono/gac/I18N/2.0.0.0__0738eb9f132ed756/I18N.dll
Loaded assembly: /usr/lib64/mono/gac/I18N.West/2.0.0.0__0738eb9f132ed756/I18N.West.dll
[0:] 
[0:] Launching sample: "Immediate mode"
 
Launching sample: "Immediate mode"
[0:] 
[0:] 
 
 
Size: 2304
System:
    Linux
 
 
 
 
SDL2 is supported
Initializing threaded X11: 1.
Display connection: 14202928, Screen count: 1
Detected configuration: Linux / Mono
Creating default GraphicsMode (32, 24, 8).
Creating GraphicsContext.
    GraphicsMode: Index: , Color: 16 (5650), Depth: 16, Stencil: 8, Samples: 0, Accum: 0 (0000), Buffers: 2, Stereo: False
    IWindowInfo: OpenTK.Platform.SDL2.Sdl2WindowInfo
    GraphicsContextFlags: Default
    Requested version: 1.0
    SDL2 created GraphicsContext (mode: Index: , Color: 24 (8880), Depth: 24, Stencil: 0, Samples: 0, Accum: 64 (16161616), Buffers: 2, Stereo: False) (flags: Default)
Bindings loaded in 48.0282 ms.
Disposing context 13708744.
Disposing OpenTK.Platform.SDL2.Sdl2GraphicsContext
Disposing OpenTK.Platform.SDL2.Sdl2NativeWindow
Disposing OpenTK.Platform.SDL2.Sdl2InputDriver
Disposing OpenTK.Platform.SDL2.Sdl2JoystickDriver
Exception occured in example Examples.Tutorial.T03_Immediate_Mode_Cube: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NotImplementedException: The requested feature is not implemented.
  at OpenTK.Graphics.OpenGL.GL.ClearColor (Color color) [0x00000] in <filename unknown>:0 
  at Examples.Tutorial.T03_Immediate_Mode_Cube.OnLoad (System.EventArgs e) [0x00000] in <filename unknown>:0 
  at OpenTK.GameWindow.OnLoadInternal (System.EventArgs e) [0x00000] in <filename unknown>:0 
  at OpenTK.GameWindow.Run (Double updates_per_second, Double frames_per_second) [0x00000] in <filename unknown>:0 
  at Examples.Tutorial.T03_Immediate_Mode_Cube.Main () [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,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] in <filename unknown>:0 
  --- 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] in <filename unknown>:0 
  at System.MonoType.InvokeMember (System.String name, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object target, System.Object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, System.String[] namedParameters) [0x00000] in <filename unknown>:0 
  at System.Type.InvokeMember (System.String name, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object target, System.Object[] args) [0x00000] in <filename unknown>:0 
  at Examples.Program.LaunchExample (System.String type) [0x00000] in <filename unknown>:0 
Disposing OpenTK.Platform.SDL2.Sdl2Factory
Disposing OpenTK.Platform.SDL2.Sdl2InputDriver
Disposing OpenTK.Platform.SDL2.Sdl2JoystickDriver

Comments

Comment viewing options

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

This exception indicates that OpenTK was not built correctly. This is caused by a long-standing bug in MonoDevelop, where it fails to respect the "AfterBuild" events defined in OpenTK.csproj. (Consider adding your vote to the Mono bug tracker.)

Possible solutions:

  • Build OpenTK from the terminal: xbuild OpenTK.sln /p:Configuration=Release
  • In MonoDevelop, enable the "Use MSBuild build engine (recommended for this project type)" option. This can be found under the project options for OpenTK.
  • In MonoDevelop, right-click and run the Generator.Rewrite project manually. You will have to do this whenever you rebuild OpenTK.

You could also use the prebuilt binaries which are guaranteed to be built correctly.

metatheorem's picture

That brought me up to speed on 1.1, thanks.