Original Post
I'm reading tutorials about picking and selecting of objects in openGL and it reads that this is done by naming and GL_SELECT rendering of objects. The list of hits is then stored in a buffer with hit's depth. It is also said that the selected object is the one closes to the viewer. (camera) But here's the question. What happens when 2 or more objects are in the same distance from the camera? Also I have 2 glspheres posistioned 5,5,0 and 10,10,0. Initialized like this
for (int c=0;c<2;c++)
{
glPushMatrix();
glPushName(c);
glPopName();
glPopMatrix();
}
Hit is detected for each object but no data is in buffer. What did I do wrong?