View Full Version : selection mode strange problem

Shao tian
02-26-2011, 01:34 PM
Hi guys:
I had a problem when using selection mode to pick glutSolidSpheres in the scene.
I have 43 spheres, with each name as 1-43.
The problem is, if I dont click on the spheres, the selection buffer indicates I have picked the last spheres, that is, selectBuff[3]=43, and the hit value given by glRenderMode(GL_RENDER) call is 1.

If I click on, for example, sphere with name=33, the glRenderMode(GL_RENDER) return value is 2. and the selection buffer indicates that I have clicked both sphere 43 and sphere 33.

I am not able to provide the code because it is in my work place. I will be able to provide the code after this weekend.
Right now I just want to ask you guys that, what kind of mistake might cause this kind of problem?

02-27-2011, 03:22 AM
If you get ID of the last sphere, and you didn't click on it, that indicates that you probably have problem with setting frustum parameters. It must be set exactly the same way as in the case of rendering.

Having multiple records in the selection buffers is regular case. All objects that intersect picking frustum are included. You have to find the nearest from the minZ parameter.

Shao tian
02-27-2011, 10:26 AM
Thanks for the reply.
After calling the last glloadname and the last sphere, my drawing function also draws objects which i dont want to pick. Is that possible that opengl thinks the last name i loaded is name for both the last sphere and all other objects, which were drawn after drawing the last sphere?