C++ 2D Graphics Library that handles 1,000,000 2D sprites?
I'm trying to do a project that need to handles very large amount of simple 2D objects, and of course needs to draw them. For that, I need a good C++ library that can handle large amount开发者_StackOverflow中文版 of "sprites".
I've been trying Qt, because I thought their "40,000 chip" demo was very impressive. However, with a bit of toying, it seems my computer has lot of trouble managing 160,000 chips. I don't know the technical details why it's slow (CPU? Bad OpenGL's GPU usage? Qt's bad for very large number of items?)
So, I've been searching the web for a library that suits my need. But I couldn't find any, mainly because no library seems to say "Hey, I'm good at managing 1,000,000 objects!", but I'm sure some libraries are more capable than others.
I don't need a library as "good" as the SDL, it doesn't matter if I don't have joystick support or whatever. I just need to display, zoom, rotate and move a large number of simple 2D objects.
Thanks!
P.S : I've tested Ogre3D. I wonder how they manage to handle 15K triangles and run at 100fps on my computer in their demo program. And, it's in 3D! Does it scale well if I go to 150K triangles?
I am guessing here, but I think the problem is that GUI toolkits (like qt, gtk) have objects that are just much too heavy for you to use 1,000,000. The GUI objects are reference counted, and have huge amounts of extra data. Really I don't think you will find a GUI toolkit that can do what you want.
However what you need is a 2d graphics (or 3d) library. For something of this size you are going to want to manage the rendering efficiently and at a pretty low level, OpenGL is a reasonable option though it requires a little bit of a learning curve (especially for sprites). But start looking at that, and find a decent library that suites you.
Maybe even just change the question to "C++ 2D Graphics Library that handles 1,000,000 2D sprites?"
To my knowledge no mainstream videogame exists that renders 1,000,000 2D sprites (particles) in one frame. A research project from 2004 showed how it could be done, however: Building a Million Particle System
In my opinion, when videogames finally do render 1,000,000 particles in a frame, they will do so via OpenCL or DirectCompute, because this avoids the famous fill-rate hardware bottleneck that makes it impractical to render particles in OpenGL or Direct3D.
精彩评论