View Full Version : Selection limitations and questions

02-08-2000, 01:36 PM
Im working on a project where we are displaying many rendered objects and we need to be able to select any one of them and return information on it. There are thousands of objects.

When working with selection mode as described in the opengl programming guide, I only seem to be able to push 128 names onto the name stack. (Win98)

Is this a limitation of the name stack ? Or am I doing something wrong ? Is there a way around it ?

The programming guide also describes "object selection using the back buffer" by assigning each object a unique color and simply checking what color youve selected. Is this the only way to implement selection of large numbers of objects ?

Any input would be appreciated.


02-09-2000, 12:15 AM
Hi !

Yes, the name stack is limited...
To know the limit, use glGetIntegerv with GL_NAME_STACK_DEPTH as parameter...

The fact is that you do not have to push the names in the stack... Each time you draw a new object, you should use glLoadName !
I believe the 'push' feature is useful when you want to be able to select sub-objects...

Let's say you render a human body... It could be composed of Larm,Rarm,Lleg,Rleg,Head,Chest,...

So you would start with :


If your objective is just to select amongst many objects that are on the same 'level', you just have to use glLoadName each time you draw a new object.

So, you are limited for the sub-objects level only....

I used to use the Color Buffer Selection trick but I discovered that using GL_SELECT mode is much more easier (and faster ?)...

Hope this helps !


02-09-2000, 06:21 AM
Yes that helps a lot, thanks !

Is there any limit to the number of named things using glLoadName() ?