picking limit

my code has lots spheres, and need to pick them.

I am picking using glRenderMode(GL.GL_SELECT) -
analyse the select Buffer.

It appears that picking works for less than 128 objects.
I do not understand this limit. Could some one let me know how I can increase this limit of my selection set…

I am appending some sample code - its not complete.

public void drawTransform()
{
if( DrawMode == true ) { drawTransformModel(); }
else if( DrawMode != true )
{
hits = 0;
x = (double) prevMouseX;
y = (double) prevMouseY;

      gl.glGetIntegerv(GL.GL_VIEWPORT, viewPort);
      System.out.println("GlSelectBuffer " + buffsize + " " + selectBuffer.length);
      gl.glSelectBuffer(buffsize, selectBuffer);
      gl.glRenderMode(GL.GL_SELECT);
      gl.glInitNames();
      gl.glMatrixMode(GL.GL_PROJECTION);
      gl.glPushMatrix();
      gl.glLoadIdentity();
      glu.gluPickMatrix(x, (double) viewPort[3] - y, 1.0d, 1.0d, viewPort);

// setView();
gl.glOrtho( bounds[0][0], bounds[0][1],bounds[1][0], bounds[1][1],bounds[2][0], bounds[2][1]);
gl.glPushMatrix();
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
//gl.glPopMatrix();

// object translation
//gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
///gl.glLoadIdentity();
///viewResize();

      gl.glTranslated( (trans.x) * (bounds[0][1] - bounds[0][0]) / Width,
                      trans.y * (bounds[1][1] - bounds[1][0]) / Height, 0.0);
      gl.glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
      gl.glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
      gl.glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);

      drawTransformModel();

      gl.glPopMatrix();

      gl.glMatrixMode(GL.GL_PROJECTION);
      gl.glPopMatrix();
      gl.glFlush();
      hits = gl.glRenderMode(GL.GL_RENDER);
      processHits(hits, selectBuffer);
      pickProcess();
      DrawMode = true;
      //gldrawable.display();
  }

}

public void processHits(int hits, int[] buffer)
{

      //System.out.println("---------------------------------");
      //System.out.println(" HITS: " + hits);
      int offset = 0;
      int names;
      float z1, z2;
      float z1Min[] = new float[hits];
      float minZ = 9999999;
      float maxZ = -9999999;
      int select=-1;

      this.nObjectHits  = hits;
      for (int i=0;i<hits;i++)
      {
              //System.out.println("- - - - - - - - - - - -");
              names = buffer[offset]; offset++;
              //System.out.println(" hit: " + (i + 1) + " ... " + names);
              z1 = (float) buffer[offset] / 0x7fffffff; offset++;
              z2 = (float) buffer[offset] / 0x7fffffff; offset++;

              for (int j=0;j<names;j++)
              {
                      if (j==(names-1) && buffer[offset] > 100)
                      {
                          selectObjectBuffer = buffer[offset];
                          System.out.println("RawHits " +i+ " " + selectObjectBuffer + " " + z1);
                          if(z1 <= minZ)
                          {
                              select = buffer[offset];
                              minZ = z1;
                          }
                      }
                      offset++;
                  }
      }

      if(select >=hits)
      {
       this.nObjectHits=1;
       this.selectObjectBuffer = select;
       //System.out.println("selectPROC :" + select);
      }
      else
      {
      this.nObjectHits=0;
      }
      //System.out.println(" HITS: " + nObjectHits);
      //for (int i=0;i<nObjectHits;i++)
     // {
      //    System.out.println("-----> " + selectObjectBuffer[i]);
      //}
      //System.out.println("ROTS " + view_rotx + " " + view_roty + " " + view_rotz);

}

What is the value of “buffsize”?

I don’t see any mention of a maximum number of hits in the docs. If there is such a limit, I guess you have to pick your sphere in batces.

i had set the buffsize to 1024, and any increase did not matter much.

is there any chance of increasing the limit on selection
set.

by batches you mean, call objects in sets of 128
thru the RenderMode(GL_SELECT) and collect the
hits. good idea.

I woud still like to know any possibility of changing the limit.

thanks tom.

-j

Did you solve this problem ?

i have the same question : How can i increase this limit ? ???