PDA

View Full Version : glLoadName.. is there a limit



Fastian
02-26-2001, 04:33 AM
Hi,

Is there a limit on how many names can we push on the name stack using glLoadName in opengl (i am doing a selection problem here) http://www.opengl.org/discussion_boards/ubb/smile.gif

thanx

Michael Steinberg
02-26-2001, 04:45 AM
maybe glGetIntegerv( GL_MAX_NAME_STACK_DEPTH, ... ) ?

Relic
02-26-2001, 05:10 AM
glLoadName replaces the top-of-stack name. it does not increment or decrement the name stack position. glPushName and glPopName do.
The maximum number of possible names is 2^32-1.

Michael Steinberg
02-26-2001, 05:39 AM
So, the basic question should have been, how many names can we push onto the stack.

Fastian
02-26-2001, 07:36 PM
Well i guess your right. The question should have been that.. http://www.opengl.org/discussion_boards/ubb/smile.gif anyway thanks for the help.

KurtCob
02-28-2001, 04:24 AM
glLoadName replaces the top-of-stack name. it does not increment or decrement the name stack position. glPushName and glPopName do.
The maximum number of possible names is 2^32-1.


2^32 is the number of names that we can put in the stack ?

Thank you for the moment
Best regards
KurtCob

Moz
02-28-2001, 05:08 AM
Try glGetIntegerv to retrieve the value of GL_MAX_NAME_STACK_DEPTH.

If you look at the red book (State variables appendix), the minimum depth of the name stack is said to be 64 (it looks pretty much like 2^6 rather than 2^32).

On Tom Nuydens' site, in the hardware section, http://www.gamedeveloper.org/delphi3d/hardware/index.shtml, you can search for the name stack's depth for several chipsets, you'll find:
Geforce2 GTS: 128
Radeon: 128
i.e. 2^7.

I don't think you can push 4 billion names onto the stack.

Bob
02-28-2001, 06:38 AM
Moz, the number of names you can place on the stack is the whole range of an integer (excluding zero, therefore 2^32-1). An integer is, in OpenGL at least, 32 bits long.

64 as you mentioned, is the (minimum) number of names you can push into the stack.

Relic
02-28-2001, 07:13 AM
>>The maximum number of possible names is 2^32-1.

Yes, what I said is that the name is an 32 bit unsigned int. The name stack itself is implementation dependend and guaranteed not to be smaller than 64 entries.

So if you really use glLoadName you can have as many as 2^32-1 different objects in the scene because the name stack pointer is never incremented or decremented.

I actually have not yet seen a necessity to use glPushName and glPopName at all except for the bottom name stack element.

Moz
03-01-2001, 02:29 AM
Ok, I get your point now.

But it seemed to me that the original question was about the stack's depth rather than about the number of possible names.

Relic
03-01-2001, 03:40 AM
>>But it seemed to me that the original question was about the stack's depth rather than about the number of possible names.

Right, and the first answer from Michael gave already the right clue. Nevertheless, you won't hit the maximum stack depth using glLoadName ever.

Fastian
03-01-2001, 04:47 AM
Thanks for all the help. It seems when we do a glLoadName we simply replace the top of the stack , which means we just lost the entry for last object... so if we do 1 glPushName and 10 glLoadName we will effetively have 1 entry on the stack...? so that means we will get the same name for every selection hit that will occur...???

Relic
03-01-2001, 07:28 AM
Pseudo algorithm:
1.) You call glLoadName before you draw the object.
2.) Draw the object. If the object would set pixels in the current view, you get the top of name stack element in the selection buffer.
3.) Goto 1. while not all named objects have been drawn.

That means the selection buffer grows which each hit and you always can check which object triggered that. No need for glPushName and glPopName as long as you don't have hierarchical selection requirements.

Fastian
03-01-2001, 09:52 PM
Ok...now iget it... thanx a lot http://www.opengl.org/discussion_boards/ubb/smile.gif