PDA

View Full Version : glSelectBuffer



Syslock
06-12-2001, 06:56 AM
How can I determine the exact size of the selection buffer that I need to
pass to the function glSelectBuffer?

I've seen in many demos that people just pick an arbitrary number like 64,
256, or 512. But this is prone to error, so I do not want to do it this way.

I thought at first the size related to the number of names I assign with LoadNames,
so if I want to select 5 objects, I would create a selection buffer that is
5*sizeof(UINT). But this is not correct as the number of hits returned is
always -1, indicating an overflow.

So, how do I determine its correct size based on the geometry that I want to
select?

Syslock
06-12-2001, 11:02 AM
The reason why I am asking is that I have geometry that is changing
(num_vertices, num_faces, etc..), so I would like to choose an
appropriate selection buffer size every time it changes.

Any thoughts?

Syslock
06-14-2001, 07:09 AM
Is this possible? Nothing in the Red book, or any other OpenGL book I know of
explains how this works in detail.

All I can do right now is guess.

martin_marinov
06-15-2001, 01:50 AM
Hi
It depends on your application. I for example use 64K ints buffer - quite big, but the user sometimes wants to select many objects ( 500-600 control points or triangles) at once. For normal scenes I think you need not more than 10K. So it is your decision. It also depends if you use hierachical or just simple selection.
Hope this helps
Martin
(By the way - the memory today is cheap, and I think 64K system memory is nothing compared to the vertices and textures caches and so on... http://www.opengl.org/discussion_boards/ubb/smile.gif)

Syslock
06-15-2001, 06:27 AM
So, regardless of your scene, you use a fixed-size buffer?

Does using a huge buffer like 64k affect performance? Does OpenGL ever walk through
the entire buffer memory (to clear it for example) or does it only access the buffer
to write values to it? I would think the latter.