C ++ 11 friendly graphics library

After several years of development in other languages, I am returning to C ++ due to the fact that some of the great features are being implemented with the ISO C ++ 11. Are there libraries (based on DirectX / OpenGL) that use these new functions in their public API (generic ptrs, lambda friendly, etc.)?

EDIT: The library may be in beta, since I do not expect any library to be commercially prepared according to a specification that is not yet fully released.

+8
c ++ c ++ 11 directx
source share
5 answers

As far as I know, there is still no complete C ++ 11 compiler. G ++ is pretty close , but does not exist yet. I would suggest to wait. It makes sense to learn the language (even if it is not available), but I think it will take several years for the dust to calm down.

As far as I know, there is little space for using any "advanced" language functions (including even everything that was present in C ++ 03) in any graphics library. Trying to make full use of hardware resources is not a place where it makes sense to use "kung fu programming" - you will end up worrying about other things, and the KISS principle takes precedence. It is either that you or you end up immersed in some very specific trigonometric nightmare that destroys consciousness, where the KISS principle takes precedence again.

As far as I know, changing the graphical API due to one language is not worth it, because accessibility in several languages โ€‹โ€‹is more important. This is especially true for OpenGL, but even DirectX has some โ€œfan-createdโ€ bindings.

At the moment, you can use any functions that you need when developing custom frameworks that work on top of the existing 3d API. General / weak pointers are useful when managing resources. However, there is no reason to use C ++ 11, since the functionality is available in boost.

- EDIT -

Qt 5 said to have C ++ 11 support. It is technically a graphical library using OpenGL ...

+1
source share

From README:

Magnum is a 2D / 3D graphics engine written in C ++ 11 / C ++ 14 and modern OpenGL. Its goal is to simplify the development of low-level graphics and interaction with OpenGL using the latest features of C ++ 11 / C ++ 14 and abstract problems associated with the platform.

+3
source share

Nothing prevents you from using, for example. lambdas, auto and initializers in any code.

Gtkmm and relatives (you can enjoy Cairo C ++ bindings ) have clean C ++ interfaces that allow you to use lambdas and autos when you see, It is very useful to use lambda as a signal handler and use auto when initializing a variable with a smart pointer Gtk.

In addition, graphical code is often a pretty minor part of an application, and for other parts you can use the correct C ++ with its full version of the standard library.

In addition, C ++ 11 support is not quite there (Visual Studio is far behind, g ++ support is not yet complete), and, therefore, libraries designed for C ++ 11 do not yet exist.

Nothing prevents you from trying and making your own :)

+1
source share

Closest to what you want is probably SFML , which is a pretty clean wrapper around OpenGL that uses modern C ++ Idioms more or less everywhere.

However, it does not use C ++ 11, and it is too large to be portable (it includes sound, network, and much more in addition to graphics).

I think this could serve as a good basis for incremental API updates for C ++ 11. However

+1
source share

Well, not in OpenGL, because it is compatible with the C API.

As for DirectX, they are certainly not going to go and change the APIs everywhere, just to include neat language features like lambdas when it's not necessary. C ++ 11 compilers are still not used in comparison with previous versions of the standard, so it would be very foolish to create an API that only a small part of developers can use.

There are vast implications for changing your API when thousands / millions of people use it. It would be extremely irresponsible of them to add lambdas to the API functions just because they are neat and shiny. Also, you donโ€™t like that you can just break your API with each new version if you like people who really use it.

EJDIT:

At first I misunderstood the question. C ++ 11 is so new that there are still no API changes for existing libraries, since it greatly limits their user base (at the moment, as far as I know, there is currently no fully functional C ++ 11 compiler, and even if most of us have not used it yet).

As some of the commentators rightly noted, I was too narrow in my original answer. You added that the beta version will be acceptable. I still don't know about any libraries that have radically changed their API to include new features in C ++ 11, and my previous point is still worth it.

Changing the signatures of API functions is dangerous because you are breaking backward compatibility. If / when these changes arrive, I expect them to be additions to the API, not changes. Perhaps someone here knows very recent changes to existing libraries that I don't know about.

0
source share

All Articles