Picking limit of 64 objects?
I''ve gone through lesson 33 about picking, and it sais you can only have a maximum of 64 objects to pick from. The thing is, I made a test program that displays 32768 objects displayed simultanious on screen, and each and every one of them can be selected without any problems.
Just wondering if I missed something, or why does this work?
You are not limited to 64 objects.
64 is limit of the stack depth.
Every stack element contains integers, which can represent something like 2^32 different objects, for EACH STACK ELEMENT, and you have UP TO 64 STACK ELEMENTS.
Than means you can code something like (2^32)^64 elements. Not enough ?
64 is limit of the stack depth.
Every stack element contains integers, which can represent something like 2^32 different objects, for EACH STACK ELEMENT, and you have UP TO 64 STACK ELEMENTS.
Than means you can code something like (2^32)^64 elements. Not enough ?

I think that it goes by how many object can end up in the selection buffer. You can have more than 64 objects, but if anymore than 64 endup being where you picked, the extras are going to get missed in the check.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
no vincoof is correct 64 is only the minimum stack depth, theres no limits to the number of objects youre able to pick (even millions)
http://uk.geocities.com/sloppyturds/gotterdammerung.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html
Ok, that sounds good. So NeNe is wrong in the tutorial then? Here''s a quote from the tutorial:
"It is VERY important to note that you can have a maximum of 64 objects on the screen (0-63). If you try to render 65 or more objects, picking becomes confused, and odd things start to happen. Everything from objects randomly exploding to your computer crashing. It''s a physical limit in OpenGL (just like the 8 lights limit)."
"It is VERY important to note that you can have a maximum of 64 objects on the screen (0-63). If you try to render 65 or more objects, picking becomes confused, and odd things start to happen. Everything from objects randomly exploding to your computer crashing. It''s a physical limit in OpenGL (just like the 8 lights limit)."
If that''s what we think, then he''s definately wrong.
There''s a limit in the stack depth, but not in the number of objects to pick.
Otherwise he assumes he assigned a selection buffer with a limited size, but that has nothing to do with OpenGL''s limits.
Could you please tell us in which tutorial it is ?
There''s a limit in the stack depth, but not in the number of objects to pick.
Otherwise he assumes he assigned a selection buffer with a limited size, but that has nothing to do with OpenGL''s limits.
Could you please tell us in which tutorial it is ?
oh, my mistake. I''ve read the posts again, but I didn''t see it...
well, anyway.
NeHe''s wrong about OpenGL''s limit.
But he can experience problems because of the buffer he uses.
His buffer is 512bytes.
Assuming that a hit has always one name in the name stack (because he resets the stack (stack size becomes 0), then pushes one name (stack size becomes 1), then always loads a name (size does not change since loading a name does replace the top stack element, and do no push a name), then each hit uses 4 long integers : 1 long for the stack depth, 1 long for znear, one long for zfar, and one long for the unique name in the stack.
The buffer has 512 bytes, each hit uses 16 bytes (4 long int == 4*(4 byte)) so the pick can at most process hits for 512/16 = 32 hits.
Obviously, 64 is too much.
But first of all, 64 does not make the program crash. At worst, picked objects won''t be detected.
And secondly, the 32hits limits (for this buffer) is the limit of simultaneously picked objects. Picked objects wil be lost only if more than 32 objects are simultaneously under the mouse cursor.
And finally, there exist a very simple method to be able to pick a bit more obkects : allocate more memory for the buffer.
NeHe''s doing a great work over his site. But he''s a human before all.
Errare humanum est.
well, anyway.
NeHe''s wrong about OpenGL''s limit.
But he can experience problems because of the buffer he uses.
His buffer is 512bytes.
Assuming that a hit has always one name in the name stack (because he resets the stack (stack size becomes 0), then pushes one name (stack size becomes 1), then always loads a name (size does not change since loading a name does replace the top stack element, and do no push a name), then each hit uses 4 long integers : 1 long for the stack depth, 1 long for znear, one long for zfar, and one long for the unique name in the stack.
The buffer has 512 bytes, each hit uses 16 bytes (4 long int == 4*(4 byte)) so the pick can at most process hits for 512/16 = 32 hits.
Obviously, 64 is too much.
But first of all, 64 does not make the program crash. At worst, picked objects won''t be detected.
And secondly, the 32hits limits (for this buffer) is the limit of simultaneously picked objects. Picked objects wil be lost only if more than 32 objects are simultaneously under the mouse cursor.
And finally, there exist a very simple method to be able to pick a bit more obkects : allocate more memory for the buffer.
NeHe''s doing a great work over his site. But he''s a human before all.
Errare humanum est.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement