Boost geometric libraries

Hi guys,

I am watching these two youtube tutorials on the boost::geometry and graph libraries

- https://www.youtube.com/watch?v=mFXD8xSXzxI
- https://www.youtube.com/watch?v=GSp2531Wti4


but both fail to mention how they actually get the shapes to appear in a GUI or on screen

do they use openGL? if so, will the boost library work with other GUI libraries like SDL and FLTK?

even more primitive,can you use the boost libraries to create simple geometric shapes on the console?

thanks!
…. do they use openGL?


The graphics system used is irrelevant , it's c++ so it should work with any other c++ system, whether it's PostgreSQL-GIS DB, FME, QT, SDL, FLTK or whatever you may have. It's up to you to use the interface to get the info, and do with it what you please, even if it is with OpenGL or the console with ncurses say. Although some of these have their own ways of doing geometry.

Good Luck :+)
If you look at convex hull or something similar, you can see that eventually what you get is a list of (x, y) points. As TheIdeasMan suggested, it's up to you to then pass this to OpenGL, or any other graphics interface. e.g. for OpenGL you would use glBufferData/glBufferSubData and pass in a pointer to an array/vector of points as the data for the last parameter.

For the second video you linked: The author mentioned that he uses "Paraview" to visualize the 3-dimensional points.
https://www.youtube.com/watch?v=mNR2Vn6r0io
Last edited on
I'm chiming in to expand on the answers you've received thus far.

Boost is designed to work with nearly anything, on nearly any platform, as long as there is a compliant C++ compiler available.

This is a direct answer to your question about using Boost with other GUI libraries - yes, it is intended to work with just about everything.

The Boost geometric library is not actually about graphics, per se, where graphics is defined as that interface or API used to display graphical results. It is a computational library designed to work on the math used to prepare the visual results, or compute such thorny issues as intersections, nearby objects, etc.

Now, as to a recommendation - that's tough.

GUI libraries typically control the user interface API of the graphics system of a platform, typically targeted at making general GUI applications (with buttons, sliders, edit controls). They can draw, but drawing is not their particular strength. Line drawing is nearly trivial, but shaded or solid 3D shape drawing is not.

A lot depends on the results you require (and determine that looking far forward in your current study and use of the geometric library). The basic division of 2D vs 3D is your first decision. In GUI, 2D can be done. If you use GUI libraries to attempt 3D line drawing, you would be required to provide the projection logic. That's not all that tough if you're familiar with linear algebra. That math basically takes a 3D image (as points) and projects that onto a 2D "view", often with the notion of a camera and it's position/orientation. This isn't part of GUI libraries, which is why it is a "manual" process.

OpenGL is a generic API near the hardware supporting 3D display. It is somewhat "universal" only in that most platforms support some version of it, but that is almost immediately sabotaged by the fact there are so many versions, some specifically intended for mobile (OpenGL ES). You could write to the older, non-programmable version for wider support, but the results are slower and naive by comparison. You can quickly become bogged down in the hard work of getting things to display if you're not already familiar. Some adaptation is required for each variation of platform.

If you want graphics results in 3D which offer shaded textures, lights, materials - or even 2D display with filled, textured output, you're going to need a rendering engine. This is similar to a game engine (which could be used), but without the sound/physics components.

There are several such engines (too many), but you might make do with some SDL variant, but I would suggest you look into GamePlay by Blackberry (the phone maker). It isn't in development now, but it is simple, so it might be a good fit. While it is a game engine, it can be used as a fairly generic rendering engine. It is so with Irrlicht, Ogre3D and others, but the study on those is a bit more complex.


Topic archived. No new replies allowed.