Determining which object the mouse is over is called picking and there are 2 main approaches:
- Color picking. Draw each object using a different color into the back buffer (this is only done when picking, the colored objects are never displayed on screen). Then use glReadPixels to read the pixel under the cursor and check its color to determine which object it is. If the mouse isn't over an object you'll get the background color. More details here: Lighthouse 3D Picking Tutorial, Color Coding
- Ray casting. You cast a ray through the cursor location into the scene and check if it intersects any objects. More details here: Mouse picking with ray casting
From reading your description option 1 would probably be simpler and do what you need.