Picking and glPushMatrix

Hi there!

(sorry, english is not my native language)
I have an interesting problem with picking. I’m trying to implement it to my leveleditor and would work fine if i didn’t use glPushMatrix and glPopMatrix. Before i draw one of my objects i push the actual matrix then a call glrotatef and gltranslatef then i draw and finally popmatrix (for all objects), and only the first object will be selected, the others are ignored, if they weren’t there. If i use translatef(-x,-y,-z)and glrotatef(…) rather then pushing and poping the matrix it works fine. Could anyone please tell me what is going on when it push and pop that stupid matrix? I can think only problems i somehow modify the modelview and the projection matrix too, and i had to change just one of them, or something like this. Please help if you have some ideas. Thanx: Imre Biro from Budapest, Hungary

Hi,

I expereinced the same thing. The solution I found: You have to pick on the lowest level of your pushes, meaning what I do is drawing all the objects doing my pick routine and then poping all the way out of the stack.

Greets,

Martin