PDA

View Full Version : GL_SELECT slow on ATI x800



Malachi
08-10-2005, 12:38 PM
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...

Humus
08-10-2005, 02:53 PM
AFAIK, selection mode isn't accelerated at all.

Java Cool Dude
08-10-2005, 04:02 PM
On ATI cards make sure your objects are not compiled (VBOs for instance) and you should be getting a healthy speed boost.

skynet
08-11-2005, 12:04 AM
Because of the speed problems with GL_SELECT, I do now use an fbo-item-buffer for selection purposes. Works beautiful and hw-accelerated :-)

MalcolmB
08-11-2005, 08:12 AM
Since selection is not accelerated does that mean ATI would rather we not use it on their hardware or is the software fallback fast enough that it should still be usable? When making a modelling application should I write my own 3D picking code for use on ATI hardware?

Thanks

Malcolm

Malachi
08-11-2005, 01:35 PM
I turned off VBO's and rendered using regular vertex arrays only and then everything works fine on the ATI x800. So, I guess GL_SELECT and VBOs don't play well together on this card. Strange. Thanks for the help. -Malachi