OpenTK:System.ExecutionEngineException 和 GLFW.PollEvents()
OpenTK: System.ExecutionEngineException at GLFW.PollEvents()
我正在尝试使用 C# 和 OpenTK 创建 2D 游戏。对于引擎部分,我大致遵循this tutorial。一切正常,直到我尝试添加纹理批处理。那时我得到了第一个 ExecutionEngineException (EEE)。现在即使我使用更改之前的代码,我也会得到一个 EEE。只有在以下情况下才会解决:
- 我只用了一个RenderBatch
- 我没有将视图和投影矩阵以及其他顶点属性传递给着色器
只要我将矩阵或附加顶点属性传递给着色器,就会抛出 EEE。
有时我也有 System.AccessViolationException,但找不到可控环境来始终如一地重新创建它。
可以在第 95 行 here. The main problem file is RenderBatch.cs and the error occurs in Window.cs 找到源代码。
程序目前处于不会崩溃的状态。
RenderBatches 的数量可以在Renderer.cs at line six with the maxBatchSize
constant and in GameScene.cs 的第21 和22 行(迭代量)中进行控制。当所有现有的 RenderBatch 都已满时,将创建一个新的 RenderBatch。目前创建了 10000 个游戏对象。 maxBatchSize
控制一个 RenderBatch 可以容纳多少个游戏对象。
将视图和投影矩阵传递给着色器是通过在 RenderBatch.cs and passing more vertex attributes to the shader is achieved by integrating the commented in line 21 and uncommenting lines 72 to 75 and 158 to 161 also in RenderBatch.cs.
中取消注释第 87 和 88 行来实现的
对于我使用的环境:
- Visual Studio 社区 2019 16.7.5
- C# 8.0 与 .NET Core 3.1
- OpenTK 4.0.0
- System.Drawing.Common 4.7.0
- .NET SDK 5.0.100-rc.1.20452.10 但从未卸载最新稳定版
- Windows 10 专业版
我现在解决了这个问题。
我在 GLFW.Init 之后而不是之前为 GLFW 设置了错误回调之后,我从 GLFW 得到了一个错误日志。此错误日志对应于找到的 here。为每个回调创建私有字段,即使它是静态方法也为我解决了这个问题。
我正在尝试使用 C# 和 OpenTK 创建 2D 游戏。对于引擎部分,我大致遵循this tutorial。一切正常,直到我尝试添加纹理批处理。那时我得到了第一个 ExecutionEngineException (EEE)。现在即使我使用更改之前的代码,我也会得到一个 EEE。只有在以下情况下才会解决:
- 我只用了一个RenderBatch
- 我没有将视图和投影矩阵以及其他顶点属性传递给着色器
只要我将矩阵或附加顶点属性传递给着色器,就会抛出 EEE。
有时我也有 System.AccessViolationException,但找不到可控环境来始终如一地重新创建它。
可以在第 95 行 here. The main problem file is RenderBatch.cs and the error occurs in Window.cs 找到源代码。 程序目前处于不会崩溃的状态。
RenderBatches 的数量可以在Renderer.cs at line six with the maxBatchSize
constant and in GameScene.cs 的第21 和22 行(迭代量)中进行控制。当所有现有的 RenderBatch 都已满时,将创建一个新的 RenderBatch。目前创建了 10000 个游戏对象。 maxBatchSize
控制一个 RenderBatch 可以容纳多少个游戏对象。
将视图和投影矩阵传递给着色器是通过在 RenderBatch.cs and passing more vertex attributes to the shader is achieved by integrating the commented in line 21 and uncommenting lines 72 to 75 and 158 to 161 also in RenderBatch.cs.
中取消注释第 87 和 88 行来实现的对于我使用的环境:
- Visual Studio 社区 2019 16.7.5
- C# 8.0 与 .NET Core 3.1
- OpenTK 4.0.0
- System.Drawing.Common 4.7.0
- .NET SDK 5.0.100-rc.1.20452.10 但从未卸载最新稳定版
- Windows 10 专业版
我现在解决了这个问题。
我在 GLFW.Init 之后而不是之前为 GLFW 设置了错误回调之后,我从 GLFW 得到了一个错误日志。此错误日志对应于找到的 here。为每个回调创建私有字段,即使它是静态方法也为我解决了这个问题。