Hi,

```
If more objects are get overlapped, the hit is not occuring. How to solve this problem?
```

The code is as follows:

[CODE}

GLuint selectBuff[BUFFER_LENGTH];

```
// Hit counter and viewport storeage
GLint hits, viewport[4];
// Setup selection buffer
glSelectBuffer(BUFFER_LENGTH, selectBuff);
glRenderMode(GL_SELECT);
// Get the viewport
glGetIntegerv(GL_VIEWPORT, viewport);
// Switch to projection and save the matrix
glMatrixMode(GL_PROJECTION);
// Establish new clipping volume to be unit cube around
// mouse cursor point (xPos, yPos) and extending two pixels
// in the vertical and horzontal direction
glLoadIdentity();
// Since OpenGL measures
// window coordinates starting at the bottom of the window, and Windows
// measures starting at the top, we need to account for this by
// subtracting the y coordinate from the height of the window. This has
// the effect of reversing the coordinate system (y starts at top)
gluPickMatrix(xPos, viewport[3] - yPos, 2, 2, viewport);
glGetFloatv(GL_PROJECTION_MATRIX, projection);
// Apply perspective matrix
glOrtho(l,r,b,t,near1,far1);
///gluPerspective(30.0f, m_WHRatio, 1.0, 2.0);
glGetFloatv(GL_PROJECTION_MATRIX, projection);
glMatrixMode(GL_MODELVIEW);
// Draw the scene
if(asc == 1 || asc == 2)
RenderScene();
else if(ger == 1 || ger == 2)
GerberDraw ();
// Collect the hits
hits = glRenderMode(GL_RENDER);
if(m_bHighlight == true)
{
CDocumentationDoc *pDoc = GetDocument();
ASSERT_VALID(pDoc);
CFileCollection* FileDetails = (CFileCollection*) pDoc -> aFileCollection_Array.GetAt(FileNo);
CMainCodes* pCodes = (CMainCodes*) FileDetails -> aFile_Details.GetAt(CodeNo);
CLineInformation* pLine = (CLineInformation*) pCodes -> Line_Information.GetAt(LineNo);
pLine -> Highlight = FALSE;
}
// If a single hit occured, display the info.
if(hits >= 1)
{
ProcessStack(selectBuff);
m_bHighlight = true;
}
```

```
if more number of objects are overlapped, the value for the variable "hits" is coming as -1.
```