Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Does anyone know what's the best graphic drawing library for C++, I want a lib that can draw basic shapes and can make image editing, gradients and vector or 3D would be great to.
The windows drawing functions are complicated and are not very advanced.
May I suggest using Cairo?
This vector library is very fast, verbose and powerful! Just look at those pretty examples!
There's even integration with OpenGL if you need vectorized 3D textures!
I tested AGG, Cairo, GDI+ and Quartz (for Mac).
I think Quartz is the best, but is available (as long as I know) for Mac only.
AGG is poweful, but is not well documented. The developer decided to reinvent the wheel, and made his own doc system, instead of using something standard like doxygen. There are good tutorials for basic understanding, but when you dig deeper you find API documentation lacking, imprecise or incomplete.
GDI+ is pretty basic compared to the others, and is available for Windows only.
As a result, I think the best choice is probably Cairo (unless you can choose to develop for Mac only). It's well documented, the code is clean, and is fast and powerful.
Check out CImg Library.
CImg stands for "Cool Image" : It is
easy to use and efficient. It's a very
pleasant toolbox to code image
processing stuffs in C++, and
potentially covers a wide range of
image processing applications.
Graphics libraries OpenGL, DirectX and game engines such as Ogre3D may be too low level for tasks like drawing shapes and gradients.
Maybe you should take a look at Cairo as mentioned above (http://cairographics.org/), or simply at Qt which has a pretty complete and efficient drawing module (http://qt.nokia.com/doc/4.5/examples.html#graphics-view) and allows high level (GraphicsScene & GraphicsView) and low level (OpenGL) drawing.
For 2D drawing, SFML provides a nice API.
See some of the quality tutorials to learn more.
DirectX and OpenGL are two options here. They're both complicated though.
Though meant for 3D you can get to do 2D stuff with Ogre3D
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
As I understand, there were no modules in early Qt versions, there were separate classes with different functions, including graphical. Opengl support was realized In qt 1.2. However, QPainter, QImage existed in early versions.
So, is it correct to say that these classes are native (in other words, classes, which were primordial); opengl classes - non-native (it is a separste branch, after all)?
I`d like to learn a further evolution of Qtopengl as non-native and alternative way for creating 2D graphics ih Qt, influence of this module on evolution of native methods (for creating 2D graphics).
So, is it correct to say that these classes are native?
No, it is not.
The reason for that is "native" would mean different things to different people. It is the matter of interpretation. See your other question how confused we got.
By now, I think you mean "non-opengl" 2/3D by native. That probably means software rasterization as opposed to be going through the display driver directly. So, still on the Qt level, but without the opengl classes in Qt.
Now, this is the point where we can come back to QImage and QPainter. Yes, QPainter is basically the initial generation for software rasterization from the times where GPUs were not so common and cheap as these days.
They are basically doing the rendering purely with software techniques. That is, it is more limited, but it worked without more expensive and less common hardwares around.
(Those were the times of Quake and other software products, fun times looking at it from today's perspective ...)
If by "native" you mean "hardware assisted", then the line isn't all so clear anymore.
Note that QPainter can use various paint engines to do the painting, so merely using a QPainter doesn't mean anything by itself.
If by "hardware assisted" one merely means using something more than legacy integer or floating point execution units of the CPU, then yes, the raster paint engine does use various SIMD/vectored operations where available. The raster paint engine is the engine used to paint on QImage, QPixmap and non-GL QWidget.
If by "hardware assistance" you mean "rendered by the graphics card hardware", then you need to use an OpenGL paint engine. It's used when you paint on a QGLWidget or in a QQuickPaintedItem. Of course the painting is still defined by the software - geometry setup and shaders are just code! This software runs on hardware that can execute it much faster than general purpose CPUs can.
Given that the fixed-function OpenGL pipeline is more-or-less a historical artifact these days, it's not incorrect to state that all of rendering in Qt is done using purely software techniques, but the software can run on a general-purpose CPU, or leverage SIMD/vector execution units on a general-purpose CPU, or can run on a GPU.
It should also be said that typical Windows drivers these days do not accelerate GDI/gdiplus drawing other than blits. Thus when doing 2D drawing using the raster engine, especially on older Windows versions like XP, Qt can be faster than platform-native 2D drawing.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I've recently encountered a need for a library or set of libraries to handle operations on 2D polygons. I need to be able to perform boolean/clipping operations (difference and union) and triangulation.
So far the libraries I've found are poly2tri, CGAL, and GPC. Poly2tri looks good for triangulation but I'm still left with boolean operations, and I'm unsure about its maturity.
CGAL and GPC are only free if my own project is free. My particular project isn't commercial, so I'm hesitant to pay or request for any licenses. But I may want to use my code for a future commercial project, so I'm hesitant about CGAL's open source licenses and GPC's freeware-only restriction. There doesn't seem to be any polygon clipping libraries with nice BSD-style licenses.
Oh, and C/C++ is preferred.
Clipper is an open source freeware polygon clipping library (written in Delphi and C++)^ that does exactly what you're asking (except for triangulation) - http://sourceforge.net/projects/polyclipping/
In my testing, Clipper is both significantly faster and far less prone to error than GPC (see more detailed comparisons here - http://www.angusj.com/delphi/clipper.php#features).
Re: Anti-grain Geometry (AGG) graphics library - it doesn't do polygon clipping, but simply uses GPC (which isn't free for commercial applications). However, Clipper does have AGG units to make clipping in AGG just as easy as GPC.
^ Edit: Clipper is now written in C# too (together with Perl, Ruby, Haskell and Flash modules written by third-parties).
PolygonLib is a new polygon clipping library written in С++ and already used in two projects. It is numerically robust, uses double coordinates, and is optimized for polygons with large numbers of vertices. See http://www.ulybin.de/products/polygonlib.php?lang=en for more details and comparison of performance and memory utilization with GPC and PolyBoolean.
The restricted evaluation version of the library is free for not commercial use and supports the operations you need (except for triangulation).
How about boost? http://www.boost.org/doc/libs/1_47_0/libs/polygon/doc/index.htm
If you're fine with the heavy use of generics in the interface, I suspect this will serve your purposes well. I'm not sure if it contains triangulation, but you can implement one of the many available triangulation algorithms if it does not.
Check out Liszt a Scala DSL
http://www.antigrain.com/license/index.html is the closest I can find, you may have to spend a buck if it does go commercial, but you can use it for free for now, and get consent later on.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am currently prototyping some algorithms in Matlab that rely on matrix, DSP, statistics and image analysis functionality.
Some examples of what I may need:
eigenvectors
convolution in 2D and 3D
FFT
Short Time Fourier Transform
Hilbert transform
Chebyshev polynomials
low pass filter
random multivariate gaussian numbers
kmeans
Later on I will need to implement these algorithms in C++.
I also have a license for Numerical Recipes in C++, which I like because it is well documented and have a wide variety of algorithms.
I also found a class that helps with wrapping NR functions in MEX:nr3matlab.h.
So using this class I should be able to generate wrappers that allow me to call NR functions from Matlab. This is very important to me, so that I can check each step when porting from Matlab to C++.
However Numerical Recipes in C++ have some important shortcomings:
algorithms implemented in a simple, and not necessarily very efficient
manner
not threaded
I am therefore considering using another numerical library.
The ideal library should:
be as broad in scope and functionality as possible
be well documented
(have commercial support)
have already made Matlab wrappers
very robust
very efficient
threaded
(have a GPU implementation that can be turned
on instead of the CPU with a "switch")
Which numerical library (libraries) would you suggest?
Thanks in advance for any answers!
You have a pretty long list of requirements, and it may be challenging to cover them all with a single library.
For general Matlab-to-C++ transitions, I can highly recommend Armadillo which is a templated C++ library with a focus on linear algebra --- and a given focus on making it easy to write Matlab-alike expression. It as very good performance, is very well documented and actively maintained. You could start there and try to fill in the missing pieces for your task.
Actually you should have a look at openCV.
Although its first goal is computer vision/image processing, this library has a lot of linear algebra tools (Almost all that you ask for). At first, this library has been implemented by intel, with a lot of focus on performance. It can handle multi thread, IPP,...
The syntax is rather easier to use than usual C++ library.
You should have a look at this cheat sheet. The syntax has been changed since version 2.0 to mimic matlab.
This library is broadly used, and well active (last big update August 2011).
NAG could be one good option. Loads of financial institutions use it in their mathematical libraries. Don't have a GPU implementation though, when I last used it.
there is also the Eigen library: http://eigen.tuxfamily.org
but it is mostly used as part of a larger framework. It offers basic (and a bit more complex) algebra
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Basically, I'm looking for a library or SDK for handling large point clouds coming from LIDAR or scanners, typically running into many millions of points of X,Y,Z,Colour. What I'm after are as follows;
Fast display, zooming, panning
Point cloud registration
Fast low level access to the data
Regression of surfaces and solids (not as important as the others)
While I don't mind paying for a reasonable commercial library, I'm not interested in a very expensive library (e.g. in excess of about $5k) or one with a per user run-time license cost. Open source would also be good. I found a few possibilities via google, but they all tend to be too expensive for my budget.
Check Point Cloud Library (PCL). It is quite a complete toolkit for processing and manipulating point clouds. It also provides tools for point clouds visualisation: pcl::visualization::CloudViewer which makes use of VTK library and wxWidgets
Since 2011, point clout translation (read/write) and manipulating toolkit has been developed: PDAL - Point Data Abstraction Library
I second the call for R which I interface with C++ all the time (using e.g. the Rcpp and RInside packages).
R prefers all data in memory, so you probably want to go with a 64bit OS and a decent amount of RAM for lots of data. The Task View on High-Performance Computing with R has some pointers on dealing with large data.
Lastly, for quick visualization, the hexbin is excellent for visually summarizing large data sets. For the zooming etc aspect try the rgl package.
Why don't you go have a look at the R programming language which can link directly to C code, thereby forming a bridge. R was developed with statistical code in mind but can very easily help not only to handle large datasets but also visualize them as well. There are quite a number of atmospheric scientists who are using R in their work. I know, I work with them for exactly the stuff you're trying to do. Think of R as a poor man's Matlab or IDL (but soon won't be.)
In spirit of the R answers, ROOT also provides a good undeling framework for this kind of thing.
Possibly useful features:
C++ code base and the Cint c++ interpreter as the working shell. Python binding.
Can display three dim point clouds
A set of geometry classes (though I don't believe that they support all the operations that you need)
Developed by nuclear and particle physicists instead of by statisticians :p
Vortex by Pointools can go up to much higher numbers of points than the millions that you ask for:
http://www.pointools.com/vortex_intro.php
It can handle files of many gigabytes containing billions of points on modest hardware.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I'm interested in creating a game that uses fractal maps for more realistic geography. However, the only fractal map programs I have found are Windows-only, for example Fractal Mapper. Needless to say, they are also not open-sourced.
Are there any open-sourced fractal map creators available, preferably in Python or C/C++? Ideally I would like something that can be "plugged into" a program, rather then being standalone.
Fracplanet may be of use.
Basic terrain generation involves creating a height map (an image) and rendering it using the pixel colour as height. So you may find image or texture generation code useful. This is a good tutorial.
For the terrain aspect take a look at libnoise.
It's packaged for Debian, and has excellent documentation with a chapter on terrain generation with example C++ code.
Of course there's a lot more to "maps" than slapping some colours on a height field (for example Fracplanet adds rivers and lakes). And the sort of terrain you get from these methods isn't actually that realistic; continents don't generally ramp up from the coast into a rocky hinterland, so maybe simulating continental drift and mountain building and erosion processes would help (alternatively, fake it). And then if you want vegetation, or the artefacts of lifeforms (roads and towns, say) to populate your map you might want to look at cellular automata or other "artificial life" tools. Finally, the Virtual Terrain Project is well worth a browse for more links and ideas.
I'd highly recommend purchasing a copy of
Texturing & Modeling: A Procedural Approach
I see it's now in it's third edition (I only have the second) but it's packed full of useful articles about the use of procedural texturing including several chapters on their use in fractal terrains. It starts out with extensive discussion of noise algorithms too - so you have everything from the basics upwards. The authors include Musgrave, Perlin and Worley, so you really can't do better.
If you want truely realistic geography, you could use NASA's SRTM dataset, perhaps combined with OpenStreetMap features. :-)
A very simple implementation would be to use the midpoint displacement fractal, http://en.wikipedia.org/wiki/Diamond-square_algorithm, or the somewhat more complicated Diamond-Squares algorithm.
http://www.gameprogrammer.com/fractal.html#diamond
These are similar algorithms to the "Difference cloud" in Photoshop.