Archived

This topic is now archived and is closed to further replies.

GL_SELECT and the Selection Buffer

This topic is 6361 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

Is there a size limit to the number of names that can be pushed on to the selection buffer? I have a mesh terrain whereby the user can select a single vertex of any mesh Unit. There are 5 vertices per unit. If I build a terrain with 40 units it seems I can only correctly select the first 125 vertices after that it does not select the correct vertex. It always defaults to the last vertex (#125). I though by specifing the selection buffer size you could add more names. I have set the buffer size to 2048bytes (even tried 10000bytes) but it seems there is a limit of 125. glSelectBuffer (BUFSIZE, selectBuf); where BUFSIZE= 2048; and GLuint selectBuf[BUFSIZE]; Any help greatly appreciated! Yes, everyone is out to get you!

Share this post


Link to post
Share on other sites
there prolly is a limit i know i can select more than that.
maybe youre loading or pushing to far.

try experimenting with these remember u can nest them

eg 40 units + each has 5 vertices (5)?

glLoadName(unitnumber);
for (vertice=0;vertice<5;vertice++)
glPushName(vertice);

Share this post


Link to post
Share on other sites
As with anything in OpenGL the depth of the name stack is prolly implementation specific. You could use a glGet with the token GL_MAX_NAME_STACK_DEPTH. According to the spec. it has to be 64 names deep.

When oh when will the IHVs release proper the specifications of their OpenGL drivers

Paul Groves
pauls opengl page
paul's opengl message board

Share this post


Link to post
Share on other sites
I did some playing around with the glGetIntegerv to determine the name stack depth and guess what....it can hold 128 names. Is there a way to increase this?!

Ready to freak right out!!


Yes, everyone is out to get you!

Share this post


Link to post
Share on other sites
I think I don''t quite understand the relationship between glLoadname and glPushname. I thought that glLoadname just replace the value at the top of the name stack and glPushname put a new name at the top moving everything else down. So if this is the case I don''t see how one glLoadname call followed by several glPushname calls would allow more names to be placed on the stack.

Can someone explain this to me?

Also how are the names referenced then?
glLoadname(2); glPushname(1)...glPushname(10).
I guess I''m asking what is the structure of the select buffer.

Thanks folks this forum really helps!

Share this post


Link to post
Share on other sites
im going like this which ables me to select 1000's of objects at a time i suppose u could replace the loadname with a pushname as well. check out chapter 13 of thge red book theres a heap of info about selecting

    
for (x=0;x<GRID;x++)
{ glLoadName(x);
for (z=0;z<GRID;z++)
{ glPushName(z);
// drawobject

}
}



thirdtime lucky source is the word i wanted
Edited by - zedzeek on July 15, 2000 7:39:26 PM

Edited by - zedzeek on July 15, 2000 7:40:03 PM

Edited by - zedzeek on July 15, 2000 7:42:33 PM

Edited by - zedzeek on July 15, 2000 7:44:30 PM

Share this post


Link to post
Share on other sites
Okay I can push names on and it seems that it knows how many vertices were selected...but say I want to perform a change on one of the selected vertices. How do I reference it?

Right now I run a linked list of vertices that is built during the drawing with GL_SELECT. I can then traverse this linked list looking for an vertex number (saved at time of drawing) that matches the first value in the select buffer. This works great upto 128 names. Now if I am nesting the names how do I know which vertex I have selected? How do the individual vertex names get saved into the name stack and then into the selectBuf when selected.

A little background may be in order...I have built a large mesh of triangles. 4 triangles make up one Mesh Unit. I want the user to be able to click on a vertex and a value will be added to the z value of that vertex (raising it up). So you can see that you can quickly exceed the 128 names stored in the name stack.

Thanks for your help!!

Share this post


Link to post
Share on other sites
Man have I been out to lunch...

I now see how this works. If I just glLoadName to the top of the name stack I replace the name at the top of the stack thereby never exceeding the name limit. The selection buffer contains the name that was loaded for the primitive that was hit.

Thanks for you help guys...I needed the pushing and idea bouncing to get this straight.

Share this post


Link to post
Share on other sites