需要帮助决定选择图形框架 [英] Need help for deciding in choose framework for graphics

查看:77
本文介绍了需要帮助决定选择图形框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在写一个科学课程,在我的课程中有40万个对象(在某些情况下超过40个)

我用c#写这个部分和WPF但是当我平移对象时它的移动非常慢。因此我决定用OpenGL写这部分,

我在代码块中测试(用于声明for {i = 0; i< 40000000; i ++}):



1- OpenGL与c#:结果不好

2- OpenGL与QT:不好。

3- OpenGL与MFC:不好的

4-在控制台应用程序中使用c ++的OpenGL visual studio:结果很好

但在这种情况下,我的程序没有GUI。



对我来说最好的框架是什么?



我尝试了什么:



1- OpenGL with c#:结果不好

2- OpenGL with QT:不好。

3- OpenGL with MFC:不好

4-在控制台应用程序Visual Studio中使用c ++进行OpenGL:结果很好

Hi
I am writing a science program and in part of my program have 40 Millions object ( in some case over the 40 )
I write this part with c# and WPF but when I pan the objects its move very slow. Therefore I decide write this part with OpenGL ,
I test in block of code ( used for statement "for{i=0 ; i<40000000;i++} " ) :

1- OpenGL with c# : result not good
2- OpenGL with QT : not good.
3- OpenGL with MFC : not good
4- OpenGL with c++ in console application visual studio : result good
But in this case I have not GUI for my program.

What is the best framework for me ?

What I have tried:

1- OpenGL with c# : result not good
2- OpenGL with QT : not good.
3- OpenGL with MFC : not good
4- OpenGL with c++ in console application visual studio : result good

推荐答案

你不理解这个问题。 />


问题不在于您选择的框架或语言。事实上,你正试图绘制40,000,000个物体!您无法使用40,000,000像素的显示器,那么为什么要尝试绘制那么多对象?



该问题的解决方案是过滤掉对象无法看到或者太小而无法渲染而只是不绘制它们。
You're not understanding the problem.

The problem isn't the framework you're picking or the language. It's the fact that you're trying to draw 40,000,000 objects! There is no way you have a monitor with 40,000,000 pixels available, so why are you trying to draw that many objects?

The solution to the problem is filtering out the objects that can't be seen or are too small to render and just don't draw them.


这些框架的问题不是任何,而是界面OpenGL与他们。我对MFC和C#的长期经验是,性能大多与C ++一样快,但实现缺陷或非最佳使用会使它们显着降低。所以我的诊断是你做的事情不是最优的。



codeproject上的工作示例就像 OpenGL MFC项目 OpenGL in .NET 。尝试在这些示例中插入您的绘图代码。



我的建议:停用部分MFC / QT / C#代码以找到您的瓶颈并优化它,如多次创建或初始化或大量对象复制,如字符串工作。我猜你会发现它; - )
The problem isnt ANY of those frameworks, but the interface of OpenGL with them. My long lasting experiences for MFC and C# are that the performance is mostly as fast as C++ but implementation flaws or non-optimal use slows them significantly down. So my diagnosis is that you are doing something non-optimal.

Working examples on codeproject are like OpenGL MFC Projects or OpenGL in .NET. Try to insert your drawing code in these samples.

my advice: deactivate parts of the MFC/QT/C# code to find your bottleneck and optimize it like multiple creation or initizialation, or massive object copying like string work. I guess you will find it ;-)


我已经用MFC和OpenGL做了很多工作,我的成绩非常好。我设置了一个16mS的更新计时器,它可以提供稳定的60FPS,显示超过1M的三角形。另外,我发现使用对话框很容易。我使用绘图的显示列表,这对我很有用。这个站点有几个使用MFC和OpenGL的程序,我试过的很好。看一下名为50 MFC OpenGL项目之类的东西。



我找到了一些用C ++和WxWidgets编写的源代码的好应用程序表现得很好。浮现在脑海中的人称为SuperShaper。您应该可以轻松找到它。



控制台应用程序选项也很好,但我不再编写控制台应用程序了。如果它适合你,那么也许这是你的最佳选择。



祝你好运。
I have done a lot of work with MFC and OpenGL and I have had very good results. I set up a 16mS update timer and it has no problems giving a steady 60FPS with more than 1M triangles displayed. Plus I find it very easy to work with dialogs and such with it. I use a display list for the drawing and that works well for me. There are several programs at this site that use MFC and OpenGL and the ones I have tried work well. Have a look at one called "50 MFC OpenGL projects" or something like that.

I have found a few good apps with source code written in C++ and WxWidgets and they perform pretty well. One that comes to mind is called SuperShaper. You should be able to find it easily.

The console app option is also a good one but I don't write console apps any more. If it works for you then maybe that is the best option for you.

Best of luck.


这篇关于需要帮助决定选择图形框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆