Advertisement Jump to content
Sign in to follow this  
twoski

Picking Algorithm - Unintended Results

This topic is 1804 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Edited by richardurich

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!