Object picking in OGL

Started by
2 comments, last by alchemar 20 years, 4 months ago
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.
Advertisement
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.
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.
I''m prety new to 3D programming I looked up ray picking and it looks complex. is there a tutorials on this?

This topic is closed to new replies.

Advertisement