Im working on a program to display data from a 3D particle simulation, the displayer reads the particle coordinates from a data file and displays them using an opengl viewer.
The particle display etc is all working nicely, and I’ve been able to implement selection of single particles with picking.
However, I want to implement a way of clicking with the mouse and dragging to select a whole area of particles (using picking). As the particle simulation is contained within a cube, I guess the best way to do this would be to first create a selection box in the XY plane, and then extend it into the Z direction afterwards. However, I don’t know how to get the coordinates on the “front” of the simulation (e.g. the XY plane of the simulation cube).
Does anyone know how I can do this? I’ve tried gluUnproject, which works if I click on a particle, but does not work if I click into empty space.
Any help appreciated, and I hope that made sense.