Jump to content
  • Advertisement
Sign in to follow this  
Mr Lane

OpenGL GL_NAME_STACK_DEPTH

This topic is 4879 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 am querying GL_NAME_STACK_DEPTH by using glGetIntegerv(GL_NAME_STACK_DEPTH, &i); however, the value of I being returned is 0...now I was under the impression that OpenGL implementations must support at least 64 names on the name stack (this is for selection and picking by the way). Obviously this isnt correct...and yes the value is being set (I initailize i to 5 just to make sure). Is there a different way to tell how many names will be supported? Also, if there is a limit of say even 128, thats MUCH to small for what I need (map editor with potentially 1000's of objects). Is there any way people can think of that I can still use OpenGL selection and picking, but kind of get around this limit? Writing my own selection and picking system would be quite difficult and time consuming... Thanks

Share this post


Link to post
Share on other sites
Advertisement
My first though was that you didn't have a valid rendering context and the value was not set, but as you say it is changed, this may not be the problem. However, check the rendering context anyway.

As for the stack depths, that's the number of simultaneous names on the stack. Do you need 1000 simultaneous names, or just 1000 individual names? The stack is for selecting an hierarchy of objects, and the stack is used to report which are the parent objects for the object being selected. For example, you draw a few cars, each cars have 4 wheels, and each wheel have 5 bolts. If you push a name for each car, each wheel and each bolt, the stack will tell you exactly which bold was selected, which wheel it's attached to, and which car the wheel is attached to (assuming they all got unique names of course). If you just want to select a few, or selveral, individual objects, then a stack depth of 1 is enough. You don't push a new name for each object, you replace the top of the stack with a new name.

Share this post


Link to post
Share on other sites
Quote:
Original post by Brother Bob
My first though was that you didn't have a valid rendering context and the value was not set, but as you say it is changed, this may not be the problem. However, check the rendering context anyway.
I have context as I am rendering to the screen.

Quote:
As for the stack depths, that's the number of simultaneous names on the stack. Do you need 1000 simultaneous names, or just 1000 individual names? The stack is for selecting an hierarchy of objects, and the stack is used to report which are the parent objects for the object being selected. For example, you draw a few cars, each cars have 4 wheels, and each wheel have 5 bolts. If you push a name for each car, each wheel and each bolt, the stack will tell you exactly which bold was selected, which wheel it's attached to, and which car the wheel is attached to (assuming they all got unique names of course). If you just want to select a few, or selveral, individual objects, then a stack depth of 1 is enough. You don't push a new name for each object, you replace the top of the stack with a new name.
The way I read this tutorial in front of me is that 1000 simultaneous objects would require a stack of 1000 names.

First though, tell me if I have got this right:

Say that the stack depth was 64 and I have 1000 objects visible on screen, each with its own unique int value as an identifier. I go into selection mode, and redefine the viewing volume to be a small area around the mouse (lets say I have created a multple selection box by draging the mouse). Now all I have to do is push the names of the things inside the viewing volume onto the name stack? So if i have 10 objects inside this volume, there would be 10 names on the stack? And this could be a maximum of 64 objects? That I can live with, most of the time i will only be selecting single objects at a time.

I was initially under the impression that if I had 10,000 objects in the entire world I would need a stack of 10,000. :)

Share this post


Link to post
Share on other sites
You really want GL_MAX_NAME_STACK_DEPTH. I think GL_NAME_STACK_DEPTPH is the current depth.

I did the same thing a while ago and zedzeek set me right.

Share this post


Link to post
Share on other sites
You're missing the point here. It is a name STACK. A stack in something you push values onto and POP them off. Read the reply by Brother Bob and actually pay attention to it this time. His answer is spot on.

But to make it more clear perhaps
LoadName onto the stack
render the ob
Go to next ob,
load a name onto the stack,
render ob. etc and repeat

This is assuming no heirarchy. The number of inidivual objects is only limited by how big you make your hit record array.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!