I am using OpenGL selection mode (GL_SELECT) to do simple picking with the mouse. We are picking on a model with around 30K polys. Everything works fine and is fast on and older NVidia GeForceFX 5200 card, but when we run the same code on a new ATI Radeon X800 card the picking takes a long time to return. It looks like the re-render of the geometry in selection mode is being done in software.
Are there any known issues with using OpenGL selection on new ATI hardware?
TIA,
Malachi
Here is the code…
// Perform the OpenGL selection
GLuint iBuffer[BUFSIZE]; // selection iBuffer
GLint iHits; // number of objects that were selected
// Get the viewport for this channel
GLint iViewport[4];
glGetIntegerv(GL_VIEWPORT, iViewport);
glSelectBuffer (BUFSIZE, iBuffer); // specify the selection buffer
(void) glRenderMode (GL_SELECT); // switch to selection mode
glInitNames(); // initialize the name stack
glPushName(0);
// Setup the Projection matrix
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
// Create a matrix that is zoomed into the portion of the screen around the cursor
gluPickMatrix((GLdouble)fX, (GLdouble)(iViewport[3]-fY), 1.0f, 1.0f, iViewport);
// Apply the Perspective matrix
glFrustum(m_fFrustumL, m_fFrustumR, m_fFrustumB, m_fFrustumT, m_fFrustumN, m_fFrustumF);
// Setup the ModelView matrix
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
m_pChannel->getCamera()->changeView();
gluLookAt( m_kCameraPos[0], m_kCameraPos[1], m_kCameraPos[2], // camera position
kLookAt[0], kLookAt[1], kLookAt[2], // look at position
m_kUp[0], m_kUp[1], m_kUp[2] ); // up vector
// Render the scene to the selection buffer
m_pDrawTraversal->update(m_pPickRootNode);
m_pDrawTraversal->draw();
// Put things back to the way they were
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
iHits = glRenderMode(GL_RENDER); // switch back to render mode
// Determine what was selected...