# Selection with region (when rendering with shaders and VAO)

I am currently render my geometry using "Modern OpenGL" approach (with shaders and buffers). I have already implemented picking of single primitives using glReadPixels. Now I am faced with problem how to implement selection of multiple objects. I cannot use glReadPixels because maximum (and it seems meaningful for me) number of objects that I could select with 10x10 box is 100. But it is really necessary for my purposes to have ability to select thousands of objects in small selection area.

I already read answer to similar question where was recommended to test each point against selection rectangle. But it gives new problems: all my vertices are already stored in buffers and it looks like huge performance to test each point on CPU.

Could someone help with such issue?

• What do you mean with "I have already implemented picking of single primitives using glReadPixels"? Are you using colorPicking? Is it acceptable for you get this selection only in top(side) view, or you need fully 3D selecting? Sep 10 '14 at 16:36
• Yes, I am using color picking. I also need fully 3D selection. Problem is color picking is not acceptable solution because I may have more then 100 elements on 1 pixel which need to be selected. Sep 10 '14 at 18:26
• Why is it limited to 100 elements? There is over 16mil colors. Sep 10 '14 at 19:03
• @wondra okay, but I guess that color picking would not work when there is to much elements at one square unit. Sep 11 '14 at 9:26
• you can always render the selected area in (much)higher resolution. Colorpicking cannot work if there are elements hiding behind each other and you want get all of them(picking regardless depth), in other cases, it will work with little tweaking. Sep 11 '14 at 12:25