简体   繁体   English

C#wpf中的sharpGL无法生成缓冲区

[英]sharpGL in C# wpf cannot generate buffers

This simple code gives system exception and I cannot trace it since I cannot make output to console in wpf. 这个简单的代码给出了系统异常,由于无法在wpf中将输出输出到控制台,因此无法跟踪它。

OpenGL gl = new OpenGL();
// OpenGL gl = openGLControl.OpenGL; doesnt change result
uint[] buf = new uint[1];
buf.Initialize();
gl.GenBuffers(1, buf); //commenting this line out, makes the exception vanish

What could cause GenBuffers method to raise the system exception in SharpGL.dll? 是什么导致GenBuffers方法在SharpGL.dll中引发系统异常?

Using last version of sharpGL and .Net 4.0 targeted VS2012. 使用SharpGL和.Net 4.0的最新版本针对VS2012。

Should I install opengl for C++ and use a wrapper of that in C# ? 我应该为C ++安装opengl并在C#中使用该包装吗?

I would have posted this as a comment, but I don't have enough rep for that: try setting the RenderContextType to DIBSection, to disable hardware acceleration and see if it still throws the exception. 我会将其发布为评论,但我对此没有足够的代表:尝试将RenderContextType设置为DIBSection,以禁用硬件加速,并查看它是否仍引发异常。

        uint[] buf = new uint[1];
        buf.Initialize();

        var cn = new OpenGLControl();
        cn.RenderContextType = RenderContextType.DIBSection;
        cn.OpenGL.GenBuffers(1, buf);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM