Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ 2D Graphics Library that handles 1,000,000 2D sprites?

Tags:

c++

graphics

qt

2d

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 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?

like image 995
B. Decoster Avatar asked Mar 18 '11 10:03

B. Decoster


People also ask

What is the best cross platform 2D graphics library?

Show activity on this post. A cross platform 2D graphics library for .Net is The Little Vector Library You could use it in conjunction with Unity 3D (recommended) or Xamarin, for example, to create 2D graphics on a variety of platforms.

What are the best open source 2D graphics projects?

Free and open source 2d graphics code projects including engines, APIs, generators, and tools. Go Graphics - 2D rendering in Go with a simple API. A powerful rendering engine implemented with Canvas2D / SVG / WebGL / WebGPU. A library for 2D graphics, written in Rust, that works with multiple back-ends

What is a device independent graphics library?

GFX is a device independent graphics library primarily intended for IoT MCUs but not limited to that. A simple 2D graphics library in C written on top of X. Its basic interface was written by Prof Douglas Thain, University of Notre Dame.

Can you do graphics using C++?

You can do graphics using C++ and also create animation. Today in this article I will introduce you all to a C++ graphic library called SDL2. I find this library as a super fun for the demonstration of my algorithms.


1 Answers

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?"

like image 168
JHSaunders Avatar answered Sep 28 '22 08:09

JHSaunders