gpt4 book ai didi

c# - OpenGL4Net System.BadImageFormatException

转载 作者:行者123 更新时间:2023-12-02 10:54:14 24 4
gpt4 key购买 nike

后续行动:
OpenGL4Net WM_PAINT does not exist?

我仍然密切关注:https://sourceforge.net/p/ogl4net/wiki/Tutorials

目前的程序:

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Forms;
using OpenGL4NET;

namespace pads2
{
class Program : Form
{
private const int WM_PAINT = 15;
RenderingContext rc;

static void Main(string[] args)
{
Program program = new Program();
program.Init();
Application.Run(program);
}

// required for open GL
void Init()
{
rc = RenderingContext.CreateContext(this);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
}

void Render()
{
gl.Clear(GL.COLOR_BUFFER_BIT);

// here is the right place to draw all your scene

rc.SwapBuffers();
}

// change window size
protected override void OnSizeChanged(EventArgs e)
{
gl.Viewport(0, 0, ClientSize.Width, ClientSize.Height);
// projection matrix may also need adjusting
}

// required for open GL
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_PAINT: Render(); break;
default: base.WndProc(ref m); break;
}
}
}
}

问:如果我正确地实现了本教程,如何处理 System.BadImageFormatException行上的错误 program.Init();

另外:

Additional information: Could not load file or assembly 'OpenGL4Net, Version=4.3.37.24, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.



这可能是由于警告:

There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "OpenGL4Net", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.



但是根据:

How do I fix the Visual Studio compile error, "mismatch between processor architecture"?

这应该不是问题。下载OpenGL4Net DLL时只有(32或64)位的选项。

鉴于Microsoft中间语言与处理器不同,我尝试以 Release模式而不是 Debug模式运行,但这没有什么区别。

最佳答案

编译时使用什么构建配置?您下载了什么版本的OpenGL4Net?是32位还是64位版本?

尝试将构建配置设置为与引用程序集的预期 objective-c pu相匹配(32位或64位,具体取决于OpenGL4Net的下载)。

有关详细说明,请参见C# compiling for 32/64 bit, or for any cpu?

关于c# - OpenGL4Net System.BadImageFormatException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38835872/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com