【发布时间】:2016-10-24 15:58:21
【问题描述】:
我正在尝试创建一个带有 openGL 画布的 Windows 窗体,或者更确切地说是一个 GLControl,因此我使用的是 openTK。因为我还是新手,所以决定试试下面的tutorial
我花了一段时间才找到一个允许我将 GLControl 添加到 Visual Studio 工具箱的版本;许多不同的版本给了我一个错误(“C:...\OpenTK.GLControl.dll 中没有可以放在工具箱上的组件)
使用来自官方 github 的当前版本终于让这部分对我有用。
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();
}
但是,当我从表单中的教程中实现它并将该方法分配给设计器中的 GLControl 时,我得到了 NotImplementedException。 glControl1_Paint(和 glControl1_Load)也是如此 我也尝试将这些方法分配给表单本身,但它产生了相同的错误。
我运行应用程序得到的输出是
'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
有谁知道是什么导致了这个问题以及我应该如何解决它? 提前谢谢!
【问题讨论】:
标签: c# winforms visual-studio opentk