Sign in to follow this  
twoski

Picking Algorithm - Unintended Results

Recommended Posts

twoski    104

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

Share this post


Link to post
Share on other sites
richardurich    1352

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).

Edited by richardurich

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this