I am trying to create a Windows Form with an openGL canvas on it, or rather a GLControl so I'm using openTK. Because I'm still new to it, I have decided to try out the following tutorial
It took me a while to find a version which allowed me to add a GLControl to the visual studio toolbox; many different versions gave me an error ("There are no components in C:...\OpenTK.GLControl.dll that can be placed on the toolbox)
Using the current version from the official github finally got that part working for me.
private void glControl1_Resize(object sender, EventArgs e)
{
int w = glControl1.Width;
int h = glControl1.Height;
glControl1.MakeCurrent();
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
GL.ClearColor(Color.SkyBlue);
GL.Ortho(-w / 2, w / 2, -h / 2, h / 2, -1, 1);
GL.Viewport(0, 0, w, h);
GL.End();
glControl1.SwapBuffers();
}
however when I implement this from the tutorial inside my form and assign that method to the GLControl in the designer I get a NotImplementedException. The same goes for the glControl1_Paint (and glControl1_Load) I have also tried to assign these methods to the form itself instead but it yielded the same error.
The output I get from running the application is
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\Users\Algernon\documents\visual studio 2015\Projects\AnalogClockTutorial\AnalogClockTutorial\bin\Debug\AnalogClockTutorial.vshost.exe'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Deployment\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Deployment.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The thread 0x2c10 has exited with code 0 (0x0).
The thread 0x2b70 has exited with code 0 (0x0).
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\Users\Algernon\documents\visual studio 2015\Projects\AnalogClockTutorial\AnalogClockTutorial\bin\Debug\AnalogClockTutorial.exe'. Symbols loaded.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\Users\Algernon\documents\visual studio 2015\Projects\AnalogClockTutorial\AnalogClockTutorial\bin\Debug\OpenTK.GLControl.dll'. Symbols loaded.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\Users\Algernon\documents\visual studio 2015\Projects\AnalogClockTutorial\AnalogClockTutorial\bin\Debug\OpenTK.dll'. Symbols loaded.
'AnalogClockTutorial.vshost.exe' (CLR v4.0.30319: AnalogClockTutorial.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
GraphicsMode.Default = Index: , Color: 32 (8888), Depth: 16, Stencil: 0, Samples: 0, Accum: 0 (0000), Buffers: 2, Stereo: False
Detected configuration: Windows / .Net
Loaded opengl32.dll: 1794703360
Exception thrown: 'System.DllNotFoundException' in OpenTK.dll
Creating GraphicsContext.
GraphicsMode: Index: , Color: 32 (8888), Depth: 16, Stencil: 0, Samples: 0, Accum: 0 (0000), Buffers: 2, Stereo: False
IWindowInfo: Windows.WindowInfo: Handle 4130538, Parent (null)
GraphicsContextFlags: Default
Requested version: 1.0
DisplayDevice 1 (secondary) supports 275 resolutions.
DisplayDevice 2 (secondary) supports 92 resolutions.
DisplayDevice 3 (primary) supports 92 resolutions.
[WGL] Creating temporary context to load extensions
Setting pixel format... [WGL] ChoosePixelFormatARB not supported on this context
10
OpenGL will be bound to window:4130538 on thread:10
Setting pixel format... Exception thrown: 'System.NotImplementedException' in OpenTK.dll
Does anyone happen to know what's causing this problem and how I should solve it? Thank you in advance!