How would you do this kind of 3d scatter plot with mouse picking in JUCE?


I would like to include a 3d scatter plot in a JUCE plugin in such a way that it is similar to the one provided by

I’m not sure if I need OpenGL for this. In addition, I’m not sure if I would be able to implement a 3d mouse picking algorithm in OpenGL!

Any advice here?

Thanks a lot!!

I thought of implementing a 3D surface plot some time ago, you might want to have a look at that thread:

In the end, I didn’t do it, as learning Open GL was too time-consuming at that moment and other tasks had a higher priority. However, while trying to figure out how to achieve my original task, I first tried to solve it with old-fashioned CPU-driven painting and got some results already looking quite similar to the graphical output shown in your link.
I’m afraid that I didn’t save my sketch code, but just take a piece of paper and think of how to calculate the 2D coordinates of each 3D coordinate for a 45° view like that, it’s really not that hard! If you figure that out, write a simple function that takes the three coordinates and returns a 2D Point object and just see how far you get with just drawing the grid lines with this and plain JUCE drawing calls. When you’ve got that working, placing some coloured circles at desired coordinates over the grid shouldn’t be that hard as well.

So, I really think this should be efficiently possible without Open GL

Thanks JanosJuce!!

If I don’t find an already-done way to do it using OpenGL, I’ll go with implementing my own “3d engine” … it sounds to me like reinventing the wheel, but maybe there’s no available wheels for this car :smiley:

If I get something, I’ll let you know.

I’ve also looked for something similar without any luck.
Less than the OpenGL complexity I was looking for a 3D renderer engine that has software renderer fallback as OpenGL especially with Windows, Plug-Ins & JUCE isn’t always working well across all systems.

It seems though that if want 3D fastest way to go with JUCE is OpenGL that you pretty much get out of the box.

I’ve yet to find a nice minimal library that could integrate nicely with JUCE.