Archived

This topic is now archived and is closed to further replies.

Object picking in OGL

This topic is 5124 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 just read in lesson 32 of NEHE''s tuts that you can only have a max of 64 objects with picking. if that is true, if i made a grid of 20 X 20 quads how would i tell what quad I clicked the mouse over? Thats 400 objects.

Share this post


Link to post
Share on other sites
I dont know about any limitations for the name stack, but imho for any games that rely a lot on object picking, you should instead use ray picking.

Look up ray picking on google you will get a lot of article on it.

Share this post


Link to post
Share on other sites
Reguardless if there is a limit is 64 objects the built in picking is increadibly slow.

As talked about above there is ray picking which is very fast.

I myself needed per pixel selection (couldnt aproximate shapes for selectible objects). With some help from people here i got a really fast per pixel method working.

I had a function that drew all my selectable objects, when i clicked i would call the function with a bool flag set to true. When true i would color each object depending on a number of the object. Then I would call a readpixels on the spot where the cursor is to get what object it is over. Then clear the buffer, and draw it as normal.

With it in color mode lighting, textures, etc will have to be disabled.

If you''re wanting to do this and having any questions feel free to ask.

Share this post


Link to post
Share on other sites