practical solution for picking/selecting objects?
I searched on Google and read some articles about picking objects in 3D, but I still can't decide which method I should use. I want to do not only picking, but selection as mouse moving, and possibly group picking as well for future projects. Is OpenGL picking good enough for this? Should I go with ray-intersection method?
I would say just do it the way you know you can do it, and decide for yourself.
A ray intersect method could be more portable I guess - but why do it the hard way if you know the way you've got in mind should work and you understand it?
A ray intersect method could be more portable I guess - but why do it the hard way if you know the way you've got in mind should work and you understand it?
loads of ways to do this.
Ray-intersection, if you want to code a ray-casting algorithm. Not hard, but it takes time. YOu'll also need some frustum clipping, for drag selection.
Another way is to use the OpenGL feedback system. either, render each object or groups of interest with a single unique and plain colour (no transparency, no lighting, no texture, nothing), see what colour you get underneath the pixel, that will give you the object.
Set the viewport to the pixel, or the area you are interested in. Use the feedback systems from OpenGL/DirectX9, which will tell you if an object has passed various render stages (especially the clipping stage), how many polygons have been drawn, ect...
I'd favor the last solution, quick, simple, hassle-free.
Ray-intersection, if you want to code a ray-casting algorithm. Not hard, but it takes time. YOu'll also need some frustum clipping, for drag selection.
Another way is to use the OpenGL feedback system. either, render each object or groups of interest with a single unique and plain colour (no transparency, no lighting, no texture, nothing), see what colour you get underneath the pixel, that will give you the object.
Set the viewport to the pixel, or the area you are interested in. Use the feedback systems from OpenGL/DirectX9, which will tell you if an object has passed various render stages (especially the clipping stage), how many polygons have been drawn, ect...
I'd favor the last solution, quick, simple, hassle-free.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement