Picking Algorithm - Unintended Results

Started by
0 comments, last by AbandonedAccount 10 years, 2 months ago

I have followed several tuts about picking and i have gotten the basics figured out, however i have come across a strange issue... My picking seems to stop working randomly. I'll click directly on a vertex i want to select and it will come back with 0 hits.

I tried upping my picking tolerance to 30 which seemed rather high and it still has issues.

Here is the relevant snippet, if anyone could point out any obvious bugs i'd appreciate it!

Here is the relevant code

http://pastebin.com/7tsuiBY0

Advertisement

First, you probably shouldn't use GL_SELECT. That said, I'm guessing you have to clear the screen (or at least the depth buffer). I'm guessing you're just seeing FP rounding causing your objects rendered to be behind what is already rendered and therefore not drawn. I have absolutely zero experience with GL_SELECT though, so I could very easily be wrong.

Did you run into trouble with the other approaches to picking? If so, I'm sure the community would gladly help you with either color-based picking (render each pickable model with a unique color, glReadPixel to see what color is at the mouse pointer) or physics-based picking (shoot a bullet from camera to mouse and collision detect).

This topic is closed to new replies.

Advertisement