SFML Backend #445
Replies: 6 comments 11 replies
-
Yes. I'm also frustrated by that. :) Gnuplot was a terrible choice, and we learned a lot from other mistakes in this library. However, I don't have the time to implement a new version. If anyone is willing to take over v2 of this library, I'm happy to help and guide them.
Still, at this point, most member functions in the figure and axes classes also need to be removed. A figure has at least one member function for each plot type. And the functions are duplicated on the axes and figure classes. Calling the function on the axes puts more content on the chart, and calling the function on the figure redirects the call to the default chart. This is repetitive and prone to errors. What's worse, that pattern from Python, when translated to C++ means we have to have all headers for all plot types included in figure header file. There should be no member functions attached to plot types. A figure is simply a sequential container of axes and axes are just sequential containers of plots. This way, users can also get used to the idea of writing their own plot types, by just defining how the inputs should be represented as fundamental data in the axes. If some plot type becomes very popular, we can port it to the main library. A minor point here: these names also came from matplotlib who took them from MATLAB, but the names are really unintuitive. It makes sense to rename them to something like figure -> figure, axes -> subplot, plot -> ?, backend -> canvas. A fourth point we need to improve is the documentation. The documentation is only composed of lots of examples: code and figures. The code examples are used as tests, but this is not great. We should have the manually written exposition describing the concepts in an intelligible order and the reference for the headers, which can be generated with mrdocs. If anyone is willing to take over v2 of this library, I'm happy to help. I'd like to see this situation improve, even if it's by some new library or by someone else. |
Beta Was this translation helpful? Give feedback.
-
I'm not interested in an SFML backend exactly, but I'm interested in seeing a full backend implementation that isn't the gnuplot one, because I want to write my own backend for my own renderer, and I want to see how it's supposed to be implemented. Currently, that's not possible as I don't know what to do, because it isn't implemented. I think a "standalone" implementation (ie., not using gnuplot) needs to be made at least as a "reference implementation" so people at least know what to do. |
Beta Was this translation helpful? Give feedback.
-
That's the problem. We don't have the human resources for that :) |
Beta Was this translation helpful? Give feedback.
-
@alandefreitas Yes. OK. What I meant is that apparently the vision of this library was to work with a backend other than gnuplot. I tried to look how to implement a backend based on the OpenGL one, but there's nothing there to base it on. I don't really know what it involves. I guess the shapes are simple enough, just send the triangles and the colour and that's done. What I don't understand so much is the text part. The library keeps does the laying out of the text? If all of it is handled by gnuplot itself then I guess that could be tricky to implement the layout out of the text. I don't really know how it works. |
Beta Was this translation helpful? Give feedback.
-
Exactly. We started with Gnuplot and later on tried to generalise it to other backends. However, this Gnuplot backend was a poor starting point, and we never really developed a good API for backends. |
Beta Was this translation helpful? Give feedback.
-
@alandefreitas OK. Does matplotplusplus actually create the vertices of the charts, and then send them to gnuplot? The shapes and lines of the charts I can see being easy enough to implement, but how does it do text for labels? It doesn't have any dependencies on stuff like Freetype or anything that does laying out of text or anything like that, so how does it know where to place the labels and stuff? Or does gnuplot do everything? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm sure I'm like many who are frustrated with the extremely limited options there are for plotting in C++. I really like this library (see here for a particle filter demo I made), but like others who want real-time performance are left wanting with the gnu-plot backend (it absolutely blows my mind the only API to that library is through pipes). I am not super familiar with OpenGL, but was looking at SFML since they recently released version 3.0 of their library. I had their demo built and running in less that one minute after cloning the repo and had a simple ball bouncing around the screen in 15 minutes without looking at the documentation. It was really pretty intuitive.
I'm curious what interest there would be in pulling in an SFML backend if I started working on one.
Beta Was this translation helpful? Give feedback.
All reactions