Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
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
Posted
Updated 12-Dec-18 6:14am

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.
 
Share this answer
 
Comments
A_javad 13-Dec-18 11:03am    
very thanks Dave Kreskowiak
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 ;-)
 
Share this answer
 
v3
Comments
A_javad 12-Dec-18 3:39am    
thanks
KarstenK 12-Dec-18 9:27am    
I added some links for examples.
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.
 
Share this answer
 
Comments
A_javad 12-Dec-18 3:51am    
hi Mr. Rick York
i test mfc and opengl from setup file that found in this site and change function draw with a for statement until to draw 40 million lines at same location but draw in the screen is very slow ( my system is core i7 ).
Do i must set something in mfc or opengl ?
(it should be noted in all of these tests i didn't use the buffer in the temporary works)
Rick York 12-Dec-18 12:24pm    
I wrote, "I use a display list for the drawing and that works well for me." This results in one call into the library to do all the drawing. Without a display list you call into the library 40M times and that is a LOT of overhead to deal with in any API.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900