Overview
My program receives some data points (0-400 per sec).
// simplified example of point's data structure
struct Point {
QPoint p;
QTime t;
quint32 value;
}
- I need to render some filtered points (eg. that
point.time > currentTime-5
andpoint.value>5
). - I need to store data history (up to ~50'000 points).
- The data can be used also on the CPU.
- I will use object-picking.
- Points are rendered in 3d.
- Camera position can change, but points data is constant.
Question
What is the best architecture to implement this kind of problem? What are best practices with this kind of data and what are practices to avoid?
Possible solutions
- Storing and filtering data.
- Store the data on the CPU (world coordinates), filtering data on a CPU and sending filtered data to VBO, calculating screen-space coordinates with shaders.
- Store the data on a CPU and a GPU (update a VBO when some new point arrives).
Filter points on CPU and calculate offsets and useglMultiDrawArrays
. - Store the data only on a GPU (update VBO when point arrives).
Filter it with shaders, get data from VBO to CPU when needed.
Solution 1. is fairly easy, but I think it is a bad practice.
Solution 2. has data duplication, but it is easy to filter the data.
Solution 3. has data reading GPU->CPU.
I tried those solutions, and Solution 2. occurs to me as the best, but there are some issues with it:
- Multiplication of data has to be handled gently.
- It is not the easiest-to-read-and-modify solution.
- When there are changes in data there is a lot of things to change.
I used something like circular buffer on VBO and send offsets to render on it.
Environment
- OpenGL 3.3
- Qt 5+ bindings
- Linux
PS
I am fairly new to computer graphics and openGL, so maybe this kind of problem even has its name. I changed my implementations few times, it took me a lot of time and I am not happy with it due to its complexity. Any materials, guides and thoughts are welcome.