2
\$\begingroup\$

How do I perform range picking in the latest OpenGL version? By range picking I mean selecting all objects which are picked using a selection rectangle, like in an RTS game.

For single object picking I'm using the ray picking method, which I guess can be used in this case as well, but I'm not sure how I should go about doing that.

Could you give me any pointers?

Thank you.

\$\endgroup\$
  • \$\begingroup\$ Can you describe how your objects are organised in memory? Do you use a scenegraph, octree, BVH or some other kind of space partitioning storage? \$\endgroup\$ – sam hocevar Sep 17 '12 at 9:03
  • \$\begingroup\$ I'm not using any yet, I'm just trying to put together a simple demo which uses ray picking. \$\endgroup\$ – Pateman Sep 17 '12 at 9:13
  • 1
    \$\begingroup\$ Related / Duplicated: gamedev.stackexchange.com/questions/35929/… \$\endgroup\$ – Dan Sep 17 '12 at 9:19
2
\$\begingroup\$

Range picking is basically a set of intersection tests between objects and camera frustum (6 planes that together define a convex volume). If you have some frustum culling code, you can just fix it up to make it work. The easiest way is to generate point data from camera matrix (view*projection), adjust the point data by means of coordinate transforms and interpolation (interpolate point data on near/far planes depending on the screen-space selection rectangle corner values) and generate planes from those points.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.