Is there a simple way to detect collisions between 2 GL objects? e.g glutSolidCylinder & glutSolidTorus
if there is no simple way, how do i refer to this objects,to their location?
and if I have their location, what should be the mathematical consideration to take in account?
No, there is no simple way. Those aren’t GL objects anyway, as OpenGL doesn’t know of any objects, as it is no scene graph or geometry library. It just draws simple shapes, like triangles or points, onto the screen and that’s exactly what
glutSolidTorusand friends do. They don’t construct some abstract object with properties like position and the like. They draw a bunch of triangles to the screen, transforming the vertices using the current transformation matrices.When you are about to do such things like collision detection or even just simple object and scene management, you won’t get around managing the objects, complete with positions and geometry and whatnot, yourself, as again OpenGL only draws triangles without the notion for any abstract objects they may compose.
Once you have complete control over your objects geometry (the triangles and vertices they’re composed of), you can draw them yourself and/or feed them to any collision detection algorithms/libraries. For such mathematically describable objects, like spheres, cylinders, or even tori, you may also find specialized algorithms. But keep in mind. It’s up to you to manage those things as objects with any abstract properties you like them to have, OpenGL just draws them and those
glutSolid...functions are just hepler functions containing nothing else than a simpleglBegin/glEndblock.