View Full Version : Ray intersect surface

02-11-2010, 01:44 PM
What is an effective/fast way to find if the ray intresect
surafce.Does OpenGL provide this functionality?
I have lots of surfaces (each surface given by the vertexes,their ordering CW/CCW is not known)

Thanks in advance for the answers!

02-11-2010, 05:57 PM
OpenGL does not provide this functionality, it just draws stuff. Google "Ray Polygon intersection" and you'll find lots of resources out there. If you want a library that supplies this functionality, try CGAL (http://www.cgal.org/)

02-12-2010, 08:51 AM
It depends on what you actually need the ray intersection for. If you need a fully functional ray intersection test for individual polygons--even the ones off screen and occluded by other polygons--you'll need a library for that as Pziko suggested.

However, if you're doing something simpler than that like "which primitive is under my mouse?" that can be done much easier.


This is a page that explains the limited selection support OpenGL provides. You can google other methods like OpenGL stencil selection. I would only use a separate ray intersection library if you really had a good use for it.