I have never used OpenGL but I think it might be the solution to a problem I have.
I want a way to store vertex data where I could add vertices to the structure and have it efficiently ignore vertices that are within a certain distance of vertices already saved.
I could do this brute force with a vector of vertices but checking the distance of every added vertex to all those that already exist is inefficient.
Does OpenGL offer some way to do this efficiently?
What other ways might I want to store 3D data so that I could update like this quickly?
Thanks for your help!
You could write a vertex shader that processes your vertices and the results would be written to a VBO with the transform feedback extension http://www.opengl.org/registry/specs/EXT/transform_feedback.txt
but I’m not sure precisely how it is done since I haven’t used transform feedback. Look for some examples to see how it works. I suppose you need to study the GL API and about shaders as well.
Alternately, you can use a GPGPU language like CUDA or OpenCL if you are just interested in data processing.
I may be missing something, but it I don’t quite see where OpenGL comes into play. It sounds more like you need a spatial data structure that can answer queries like “what is the closest vertex to point p?” or “which vertices are within a distance d from point p?” with the additional requirement that the structure needs to support insertion of new vertices.
A KD-Tree or an octree could answer those queries. The KD-Tree might need to be rebuilt every N insertions though, depending on how uniformly distributed the inserted vertices are, the octree should only require local refinement when a leaf is full.